My 3D engine stores meshes with geometry vertices, color vertices, normal vertices, and texcoord vertices. A cube has 8 geometry verts, 6 normal verts, 1 color vert, and 4 texcoord verts.
Whenever the mesh is altered, I recompile vertex arrays for the different kinds of vertices, but I end up repeating a lot of data, because GLDrawElement only takes a single list of triangle vertices. Is there any for me to tell GL to use the 1st vertex in the vertex array, the 3rd in the color array, and the nth in the texcoord array, for one vertex of a triangle?
[This message has been edited by halo (edited 12-17-2003).]
I’m not sure if that was clear.
Let’s say a mesh has 30 vertices, and 4 different colors. Is there any way to tell GL to use vertex 28, but use color 3, or do I have to just list all the vertex colors in order? I have it working now, but I am using 30 vertex color values, when I actually only need 4.
Unfortunately there’s no way to use seperate indices, so you’re doing exactly the right thing. You could use immediate mode to render from seperate arrays, but unless you’re seriously running out of memory, it’s going to be a loss.
That’s kind of surprising, given the vertex-driven nature of GL. Okay, I won’t mess with it then.