Reputation: 1670
I know that when glDrawElements is called it uses a buffer of indices to determine what vertices to draw in what order. My question is how those indices are applied to texture, normal, and color attributes. Is it possible to set another index array for what texture coordinates and normals are supposed to be used for each vertex. Or do I have to create the normal and texture coordinate buffers so that they align with the vertices being drawn?
Upvotes: 1
Views: 696
Reputation: 162164
Is it possible to set another index array for what texture coordinates and normals are supposed to be used for each vertex.
No. For a good reason:
Or do I have to create the normal and texture coordinate buffers so that they align with the vertices being drawn?
Don't try to see vertex, normal, texture coordinate and so on as different vectors assigned to a vertex (-position). A vertex is actually a compound vector, which covers all those attributes. The old terminology stems from the fixed function pipeline. Modern OpenGL only knows generic vertex attributes.
So every index refers to exactly one specific vertex vectors. If there is a difference in any attribute, then it's a different vertex and hence is to be given a different index.
Upvotes: 5