Back to project page touchgloid.
The source code is released under:
MIT License
If you think the Android project touchgloid 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 rucamzu.opengl; //from w w w. j a v a2 s . c om import static android.opengl.GLES20.GL_ARRAY_BUFFER; import static android.opengl.GLES20.GL_STATIC_DRAW; import java.nio.FloatBuffer; public final class VertexBuffer extends Buffer { private static final int TARGET = GL_ARRAY_BUFFER; private static final int DEFAULT_USAGE = GL_STATIC_DRAW; public static VertexBuffer create() { return new VertexBuffer(Buffer.generateBufferId()); } public static VertexBuffer create(float[] vertices) { return create(vertices, DEFAULT_USAGE); } public static VertexBuffer create(float[] vertices, int usage) { VertexBuffer vertexBuffer = create(); vertexBuffer.bind(); vertexBuffer.buffer(vertices, usage); vertexBuffer.unbind(); return vertexBuffer; } private VertexBuffer(int id) { super(id); } public void buffer(float[] vertices) { buffer(vertices, DEFAULT_USAGE); } public void buffer(float[] vertices, int usage) { buffer(buildFloatBuffer(vertices), usage); } public void buffer(FloatBuffer vertices) { buffer(vertices, DEFAULT_USAGE); } @Override protected int target() { return TARGET; } }