glDrawElements , glDrawArrays, and Animation
Alright, here is a question that I'm sure has been done to death.
As far as I know, there are two basic ways to use Vertex Arrays, glDrawElements and glDrawArrays.
The problem that arises with using glDrawElements is that while you can use indices to access vertex data, they must all share the same attributes such as normals, colors, and texture positions, and not just position.
glDrawArrays works fine for the above problem, however with glInterleavedArrays I am recreating 6 vertices, with different attributes, in the same position. Which is fine, memory is cheap, until I start animating it, and then I'm moving 6 vertexes for every 1 in my file.
Example:
a---b---c
|../.|../.|
|./..|./..|
d---e---f
|../.|../.|
|./..|./..|
g---h---i
6 triangles share the position e, but all have there own vertices. If I want to animate e, I have to move not 1 but 6 vertices.
Anyway, that is my understanding of the subject. If anybody has any advice on how I can animate it with fewer calls, organize it to use indices, maybe there's a concept with these methode I'm not getting, etc, I would be most appreciative.
-Rich
If the triangles share vertex e, there only needs to be one copy of e. As you said, if you need different texture coordinates for the same position (for example), then you'll need to duplicate the vertex, otherwise you don't, just index it whenever you need it.
If at first you don't succeed, redefine success.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement