Back to project page opengl.
The source code is released under:
Apache License
If you think the Android project opengl listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.androidbook.opengl; /*from ww w.jav a 2 s .c o m*/ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.nio.IntBuffer; public abstract class SmallGLUT { public static final float PI = 3.14159265358979323846f; ByteBuffer getByteBufferFromByteArray( byte array[]) { ByteBuffer buffer = ByteBuffer.allocateDirect(array.length); buffer.put(array); buffer.position(0); return buffer; } FloatBuffer getFloatBufferFromFloatArray(float array[]) { ByteBuffer tempBuffer = ByteBuffer.allocateDirect(array.length * 4); tempBuffer.order(ByteOrder.nativeOrder()); FloatBuffer buffer = tempBuffer.asFloatBuffer(); buffer.put(array); buffer.position(0); return buffer; } IntBuffer getIntBufferFromIntArray( int array[]) { ByteBuffer tempBuffer = ByteBuffer.allocateDirect(array.length * 4); tempBuffer.order(ByteOrder.nativeOrder()); IntBuffer buffer = tempBuffer.asIntBuffer(); buffer.put(array); buffer.position(0); return buffer; } }