Vertex arrays

Started by
4 comments, last by Aargyle 20 years, 11 months ago
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]
Advertisement
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
--------------------------------------------------"I have never let my schooling interfere with my education. " --- M.TwainMarcus Hayswww.phrenicgames.com
You need to use glEnableClientState when working with any of the 6 arrays.
I don't have a signature
Also, heres a small program I made last week the does the basics of setting up vertex pointers.

http://home.earthlink.net/~bjonesds12/Programming/OpenGL/VertexArray1WGL/main.cpp

I don''t have a signature
I don't have a signature
Just look at the render function.

I don''t have a signature
I don't have a signature
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)
f@dzhttp://festini.device-zero.de

This topic is closed to new replies.

Advertisement