Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (22 sloc) 1.027 kB
<snippet>
<content><![CDATA[// import java.nio.IntBuffer;
// import java.nio.FloatBuffer;
// import com.sun.opengl.util.BufferUtil;
// You might need to create four buffers to store vertext data, normal data, texture coordinate data, and indices in vertex arrays
IntBuffer bufferObjects = IntBuffer.allocate(${1:4});
gl.glGenBuffers($1, bufferObjects);
int vertexCount = ${2:3};
int numCoordinates = ${3:3};
// vertexCount * numCoordinates
FloatBuffer vertices = BufferUtil.newFloatBuffer(vertexCount * numCoordinates);
float[] v = {0.0f, 0.0f, 0.0f,
1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 1.0f};
vertices.put(v);
// Bind the first buffer object ID for use with vertext array data
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, bufferObjects.get(0));
gl.glBufferData(GL.GL_ARRAY_BUFFER, vertexCount * numCoordinates * BufferUtil.SIZEOF_FLOAT, vertices, GL.GL_STATIC_DRAW);]]></content>
<description>glGenBuffers</description>
<scope>source.pde</scope>
<tabTrigger>glgenbuffers</tabTrigger>
</snippet>
Jump to Line
Something went wrong with that request. Please try again.