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; /*w w w . j av a 2 s . c o m*/ import static android.opengl.GLES20.GL_ELEMENT_ARRAY_BUFFER; import static android.opengl.GLES20.GL_STATIC_DRAW; import java.nio.ShortBuffer; public final class IndexBuffer extends Buffer { private static final int TARGET = GL_ELEMENT_ARRAY_BUFFER; private static final int DEFAULT_USAGE = GL_STATIC_DRAW; public static IndexBuffer create() { return new IndexBuffer(Buffer.generateBufferId()); } public static IndexBuffer create(short[] indices) { return create(indices, DEFAULT_USAGE); } public static IndexBuffer create(short[] indices, int usage) { IndexBuffer indexBuffer = create(); indexBuffer.bind(); indexBuffer.buffer(indices, usage); indexBuffer.unbind(); return indexBuffer; } private IndexBuffer(int id) { super(id); } public void buffer(short[] indices) { buffer(indices, DEFAULT_USAGE); } public void buffer(short[] indices, int usage) { buffer(buildShortBuffer(indices), usage); } public void buffer(ShortBuffer indices) { buffer(indices, DEFAULT_USAGE); } @Override protected int target() { return TARGET; } }