Archived

This topic is now archived and is closed to further replies.

Aargyle

Vertex arrays

Recommended Posts

I would like to use vertex arrays as openGL has native support for it, so they should be much faster. However in the OpenGl game programming book it says to switch between these arrays using gl*pointer(); but I can't find that one in the bluebook (* is not alphabetical? hehe). Can anyone outline the general procedure for setting up multiple vertex arrays and then switching between them to render? And is there any downside to using these things? Thanks much! edit: I mean the openGL vertex arrays that you have to enable with glEnableClientState(enum glarray), not my own generic vertex arrays. [edited by - aargyle on April 29, 2003 3:37:32 AM]

Share this post


Link to post
Share on other sites
here''s how i do it in part of my code...


  
glEnable(GL_VERTEX_ARRAY);
glEnable(GL_TEXTURE_COORD_ARRAY);


glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, Vertices[Frame % NumFrames]);
glTexCoordPointer(2,GL_FLOAT,0,TVertices);
glColorPointer(3, GL_UNSIGNED_BYTE, 0, Colors[Frame % NumFrames]);


glDrawArrays(GL_TRIANGLES, 0, ArraySize/3);






--------------------------------------------------
"I have never let my schooling interfere with my education. " --- M.Twain
Marcus Hays
www.phrenicgames.com

Share this post


Link to post
Share on other sites
and when you feel comfortable with vertex arrays and/or interleaved arrays you can have a look at either nvidia vertex array range extension or the rather new vertex buffer object extension (id prefer the later one.. its a little more work, but also more flexible, better supported and probably have a little better performance)...

those files might be horrible too look at but worth the time if you take it.
http://oss.sgi.com/projects/ogl-sample/registry/

if i remember that right you could even have indices in such an object and store it in video memory (would be pretty neat for complex things)

Share this post


Link to post
Share on other sites