Imagine I have a vertex array and an index array. Suppose it is possible to rearrange the elements in the index array so that a single call glDrawElements
with GL_TRIANGLE_STRIP
draws the desired figure. Another possibility would be to call glDrawElements
with GL_TRIANGLES
but this would make the index array longer.
Does it really matter in terms of efficiency (I mean real efficiency, not some microoptimizations) which way I choose or is the underlying routine the same anyway?
A side note: The reason I am reluctant to rearrange my elements to use GL_TRIANGLE_STRIP
is that because I think that the triangles in the strip will have alternating winding. Am I wrong?
There's no really performance differences between a call with GL_TRIANGLE_STRIP
and GL_TRIANGLES
.
Now if you can rearrange your indices for maximizing post-transform vertex cache, you can have huge performance gains. I did so years ago for rendering large terrain patches and observed 10 to 15 times FPS speedups (using some kind of Hilbert curve scheme).
I think that GL_TRIANGLE_STRIP
and GL_TRIANGLES
are quite as efficient, if your indices are ordered in a way to maximize vertex transform cache. Of course it will take more memory to store.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With