Question

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?

Was it helpful?

Solution

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!).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top