glDrawElements() some questions ..

Member
Posts: 157
Joined: 2002.12
Post: #1
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. Sad
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #2
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.)
Quote this message in a reply
Member
Posts: 157
Joined: 2002.12
Post: #3
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. Smile
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  glDrawElements and Face indices Ashford 8 13,069 Nov 11, 2009 03:03 PM
Last Post: Ashford
  Agh! glDrawElements kills my artwork ferum 2 3,610 Nov 23, 2006 09:05 AM
Last Post: ferum
  glDrawElements question Falcor 20 11,915 Feb 2, 2006 02:50 PM
Last Post: akb825
  glDrawElements question Jake 9 4,547 Jun 24, 2004 08:13 PM
Last Post: Jake
  glDrawElements vs. glDrawArrays - The numbers are in! inio 22 20,583 Jul 19, 2003 10:00 AM
Last Post: Josh