Hi! I've been googling around for information about index buffers. The one problem I still have is how to actually 'reference' each vortex and how an index buffer is actually formatted. Could anyone provide me with a basic example of how to use one with a vortex buffer (im using the fixed pipeline, GL11/GL12).
Thanks,
Matt.
The only thing I could come up with: http://www.gamedev.net/topic/466568-opengl-index-buffers--ibo-/
I am still a newbie, so that may be the reason I am not getting what you are looking for.
But anyways, I am pretty sure it's called "vertex" and not "vortex".
And also since I am not sure what you are looking for ill give this a try.
public void updateBufferData(int id, FloatBuffer buffer) {
if (GLContext.getCapabilities().GL_ARB_vertex_buffer_object) {
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, id);
ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, buffer, ARBVertexBufferObject.GL_DYNAMIC_DRAW_ARB);
}
}
public static void updateElementData(int id, IntBuffer buffer) {
if (GLContext.getCapabilities().GL_ARB_vertex_buffer_object) {
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, id);
ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, buffer, ARBVertexBufferObject.GL_DYNAMIC_READ_ARB);
}
}
public int createVBOID() {
if (GLContext.getCapabilities().GL_ARB_vertex_buffer_object) {
IntBuffer buffer = BufferUtils.createIntBuffer(1);
ARBVertexBufferObject.glGenBuffersARB(buffer);
return buffer.get(0);
}
return 0;
}
You have the function createVBOID that "creates" a new pointer to a buffer object.
And then you can add vertex data using updateBufferData and you can use the updateElementData to add vertice indexes.
Again this is still new contents for me and I am pretty sure I don't fully understand this content.