PDA

View Full Version : Vertex Arrays



Whittick
06-28-2000, 08:16 AM
I am having a bit of trouble getting my head around vertex arrays. Basically i have this problem, I have an array of vertex information, so I Enable GL_VERTEX_ARRAY, then make my call to glVertexPointer().

What I dont understand is where to go from there. This is because im loading data in from a file (about 4500 verts). I am unsure how to specify the Indices for each triangle from this data I have loaded.

Thanks for any help
Chris


[This message has been edited by Whittick (edited 06-28-2000).]

Glenn Upton
06-28-2000, 08:39 AM
Specifiy the indices same way you would if you had the vertices in an array already. The indices also go into an array, the indices in the sequence required to draw your triangles. E.G.
GLubyte indices[]={0,1,2,0,2,3....
glDrawElements(....indices)
Hope that helps.

Whittick
06-28-2000, 09:16 AM
Is there a way to generate this array from my data.

The data is ordered sequencially, so there are some repeating vertices.

Glenn Upton
06-28-2000, 08:24 PM
If I understand this correctly, you should load the array outside of your rendering loop, then access the array, probably in a display list, to construct your geometry, then call the display list in your rendering loop.
pseudocode:
read file and load array
display list:construct geometry (using loaded array)
rendering loop: call displaylist
Am I in the ball park here?