Multiple Vertex Arrays...

Hi,
I’ve been reading for the last 2 weeks or so, ran into a question… (no, I’m not trying to make an “engine”. )

I have created a vertex array, and been able to render it. No sweat. BUT, how would I go about doing multiple vertex arrays?

One would go like:
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, &torusVerts);
glDrawElements(GL_TRIANGLES, 1728, GL_UNSIGNED_INT, torusFaces);
glDisableClientState(whatever);

Could I then make a new vertex pointer to a different array, and then immediately render another array?

Or would I do it all within the enable/disable pair?

If I do multiple vertex arrays inside the pair, how do they know which two arrays (one for vertices, one for faces) coorespond to each other?

Thanks.

You can use any number of vertex arrays. And you would want to do it all within the glEnableClientState/glDisableClientState pair just to minimize function calls and client state changes. You don’t show it in your example, but I’ll mention it anyway, if you happen to be using compiled vertex arrays, then you must unlock the vertex array before changing the vertex pointer (and then relock the array if necessary).

[This message has been edited by DFrey (edited 09-17-2000).]

Originally posted by DFrey:
if you happen to be using compiled vertex arrays, then you must unlock the vertex array before changing the vertex pointer (and then relock the array if necessary).

How and What is unlocking the vertex array? I have the OpenGL Super Bible, along with several examples, and I haven’t seen any examples of using more than one Vertex Array at once… hence, no idea that lock/unlocking would be accomplished…

Don’t worry about locking or unlocking the array if you aren’t using compiled vertex arrays. And from your example you aren’t.
For the code you have shown, you can change the vertex array pointer anytime within the glEnableClientState/glDisableClientState pair.