Back to project page OpenGL-es3-android.
The source code is released under:
GNU General Public License
If you think the Android project OpenGL-es3-android 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.opengles3.demo.geometry; /*from w ww.j ava2 s. c om*/ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import android.opengl.GLES30; public class VertexArray { private FloatBuffer floatBuffer; private final static int BYTES_PER_FLOAT=4; public VertexArray(float[] vertexData){ floatBuffer = ByteBuffer .allocateDirect(vertexData.length*BYTES_PER_FLOAT) .order(ByteOrder.nativeOrder()) .asFloatBuffer() .put(vertexData); } public void setVertexAttribPointer(int dataOffset,int attributeLocation, int componentCount, int stride){ floatBuffer.position(dataOffset); GLES30.glVertexAttribPointer(attributeLocation, componentCount, GLES30.GL_FLOAT, false, stride, floatBuffer); GLES30.glEnableVertexAttribArray(attributeLocation); floatBuffer.position(0); } }