View Full Version : Please help my ignorance of vertex arrays

10-30-2001, 05:27 AM
Ok here is my problem. I want to use triangle stips, (much easier to code than triangles), I want each triangle face to have a normal, and each triangel vertex to have a texture coord. I realize that i will have to load a large texture with alot of small textures within itself to get the desired effect, but my main concern is what the fastest way to do this would be. Can I make an array of the vertices, or what?? Please help. I have alot of polys to create, and i dont want to use a modeler for them. I would rather work with the code. Thanks.

10-30-2001, 07:20 AM
The slickest way is to create your model as an indexed vertex array: the vertices are in one array, and the triangles are represented in an index array - each triple containing the appropriate indices from the vertex array.

It can be a little tricky to set up if the model is complex, but once it's done, normals, colours, and textures can be put in arrays with their indices corresponding to the indices of the vertices in the vertex array.

The cool thing is that the whole thing can be rendered with one call to glDrawElements. A slight drawback (especially if you NEED a normal for each face)is that each vertex can conveniently have only one normal, colour, texture, etc.

It might be helpful that the VRML "indexed face set" uses the same structure for model data and lots of files containing these models can be downloaded from the net.