PDA

View Full Version : array elements buffer



yossi
05-25-2006, 05:10 AM
Hi guys,
I am trying to create and use array elements buffer with no success.
I have no problem to find examples of how to work with VBOs but don't know how to incorporate buffers of indices.

My code is like this:

// Create indices buffer
glGenBuffers(1, &Id);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, Id);
glBufferData(GL_ELEMENT_ARRAY_BUFFER_ARB, ...

Using the buffers:
glEnableClientState(GL_VERTEX_ARRAY);
// Enable client state for indices buffer?
//

glBindBuffer(GL_ARRAY_BUFFER_ARB, ....
glVertexPointer(3, GL_FLOAT, 0, 0);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, ...
// Is it needed?
What is the equivalent of 'glVertexPointer' to indices array?

I am little bit confused... :(
Please your help,

Yossi

V-man
05-25-2006, 06:51 AM
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, ...)
// Is it needed?

Yes


glDrawRangeElements(...)
or
glDrawElements(...)

you can give 0 for the address index address.

yossi
05-25-2006, 06:55 AM
Thanks V-man,
I managed to make it working,