PDA

View Full Version : opengl optimization



Pierre
03-09-2010, 06:33 PM
ello to all the community

I'm creating a game with 3D characters with more than 10 000 points.
Ultimately, the game reaches over 100 000 points and again it's not all over.

The game is slow because I use glVertex among others.

What is the best way to optimize display vbo, vba or something else?

Knowing that the characters are animated and static as the other trees.

Could you give me also all but really anyone can make me win one frame per second?

Thank you and goodbye,

Dark Photon
03-10-2010, 05:24 AM
I'm creating a game ...100 000 points...slow because I use glVertex ... What is the best way to optimize display vbo, vba or something else? ...the characters are animated and static as the other trees.
Define "best" ;)

The currently recommended approach is to use VBOs (http://www.songho.ca/opengl/gl_vbo.html). Basically, put all your vertices in lists and give them to the driver. Then when you're ready, issue a "draw call" (such as glDrawElements, glDrawArrays, etc.) to tell the GPU to render them all at once in one "batch".

In practice you can get even higher performance from VBOs by additionally using bindless (http://developer.nvidia.com/object/bindless_graphics.html) (on NVidia), or VAOs (http://www.opengl.org/wiki/Vertex_Array_Objects) (on NVidia/AMD). But plain VBOs are likely to be so much faster than your immediate mode code that you probably won't even care.

Of course, if you don't care about long-term portability, you can try using a display list (http://www.lighthouse3d.com/opengl/displaylists/). Particularly on NVidia, the performance of this can rival VBOs+bindless, and they are very easy to try. Note: display lists were deprecated in OpenGL 3.

dorbie
03-11-2010, 08:19 PM
Well VBOs are not dispatched using glVertex, the most important thing is to use glDrawElements or one of the variations on it.

Use a cache coherent tri strip (nvtristrip will build one for you)

Once you do this you can then use VBOs for the attribute buffer.

It will fly compared to your current application.