Efficiency in redistributing arrays in OpenGL

Imagine I have an array of vertices and an array of indices. Suppose you can change the elements in an index array so that a single glDrawElements call with GL_TRIANGLE_STRIP draws the desired digit. Another possibility would be to call glDrawElements with GL_TRIANGLES , but that would increase the index array.

Does it really matter in terms of efficiency (I mean real efficiency, not some micro-optimizations), how do I choose or the underlying subroutine anyway?

Note: the reason I reluctantly rearrange my elements for using GL_TRIANGLE_STRIP is because, as I think, the triangles in the strip will have a variable winding. I'm wrong?

+4
source share
4 answers

There is no performance difference between a call with GL_TRIANGLE_STRIP and GL_TRIANGLES .

Now, if you can change your indexes to maximize the vertex copy cache after conversion, you can get a huge performance boost. I did this many years ago to render large areas of the terrain and observed FPS acceleration from 10 to 15 times (using some kind of Hilbert curve scheme).

+5
source

I think that GL_TRIANGLE_STRIP and GL_TRIANGLES are effective enough if your indexes are ordered in such a way as to maximize the cache of the vertex transform file. Of course, storage will require more memory.

+4
source

There is probably not much difference in performance. But he still recommended that you not use any of the methods in the main rendering cycle. Use display lists instead. I converted part of my OpenGL code to display lists, and this happens faster because you end up cutting a ton of CPU-> GPU communication.

There is a tutorial here: http://www.lighthouse3d.com/opengl/displaylists/

+2
source

It all depends on what your driver should do with your vertex data. If it needs to do some processing (turn QUADS to TRIANGLES, as it usually happens), then this will not be optimal. The only way to see what is best for your driver is to measure. Find the opengl benchmark and see which vertex primitives are optimal for your driver.

Since you want to compare GL_TRIANGLE_STRIP and GL_TRIANGLES, most likely you will lose performance in this case.

+2
source

All Articles