I am currently using glDrawElements to render a mesh (terrain) that may have occasional udpates to it (terrain morphing). Wondering if i should technically go with glDrawArrays instead?
Asked
Active
Viewed 92 times
1 Answers
2
Really depends on whenever all your primitives use different vertices or not. In your terrain example, if the layout is a grid, each row of primitives will share vertices with the previous row. If you call to glDrawArrays
instead of glDrawElements
you would need to pass down repeated vertices, and that is most costly (more vertices to transform).
Updating vertices has nothing to do on how do you render it, keep your list of elements static in the GPU memory, and update the vertices (unless your morphing requires to update elements too, in this case don't make them static).
That being said try both and see what is faster (profile!).

Trax
- 1,890
- 12
- 15
-
I dont quite follow. I agree though, i like using a VBO because i can use an index buffer. But im not clear what you mean by "update vertices unless morphing requires to update elements too...". What do you mean by elements? – AlvinfromDiaspar May 21 '13 at 05:19
-
By elements I mean indexes. If your morphing requires to change indexes then you won't be able to specify the indexes array as static. – Trax May 21 '13 at 05:23
-
My indices are always the same. THe only thing that could change are possibly vertex colors and their locations. – AlvinfromDiaspar May 21 '13 at 05:39