PDA

View Full Version : glDrawElements() some questions ..


NYGhost
2004.11.15, 04:53 PM
Hello again!

I know glDrawElements() allows me to specify vertex indexes to be rendered.

Enabling the GL_TEXTURE_COORD_ARRAY is like extending the definition of the a point to include texture coords.

the question is:
Is there a way to specify UV indexes to use when rendering the primitives?

the reason for my question is that my geometry may have different number of vertex, UV, and normals so glDrawElements() would render incorrectly.
the way I draw textured triangle is by using 6 indexes (3,3) three for each vertex array.

I know by switching to vertex arrays would eliminate lots of overhead, but,
Is it worth it?

If there's no way to specify those UV indexes I would have to preprocess the geometry, and add the missing elements. :(

arekkusu
2004.11.15, 08:36 PM
All data must be uniform in vertex arrays. You can't specify texture coords for some vertices and not others. You can reuse some vertices in a mesh with indices, but all attributes must be specified for each vertex (you only get one index array.)

NYGhost
2004.11.15, 09:15 PM
thanks arekkusu

I modified my data and everything's working just fine, it was easier than what I thought.
My rendering code was reduced significantly!, I should have done this earlier.

the bad thing is that now I have to recreate my skeleton vertex linkage since now I have more vertices per mesh. :)