PDA

View Full Version : Performance 2d/display lists



Felipe R.
06-25-2009, 12:15 PM
Hi everyone

Do you guys know if it is faster to use glDrawElements, glMultiDrawElements, etc "inside" display lists, or the display lists are already optmized to be as fast as possible?
Another thing, and I am not sure if here is the right place to ask this but, which one is faster
to draw 2d graphics: plain SDL or SDL with openGL using ortho2d or something like that?

Thanks

awhig
06-25-2009, 12:33 PM
I guess, the combination of the two would give you best performance. A display list is recommended as it assures a fixed space in memory at compilation time. No re-compilation is required.

glDrawElements() is to save multiple calls for feeding in vertices for a complex primitive.

If compile time is taken to account then display lists should be faster, but at run time (for the same primitive and assuming a complex primitive with multiple calls in display list and the equivalent glDrawElement -- vertex array ) , the latter should be fast.

awhig
06-25-2009, 12:35 PM
Not clear what is SDL.

Ilian Dinev
06-25-2009, 12:48 PM
For static stuff, display lists are the fastest. Once you declare them with glDrawElements or whatever to be compiled-in, the memory arrays you specify are cloned, optimized, and uploaded to VRAM.

The thing is,... I've never seen 2D needing static stuff when textured rectangles need to be drawn for a scene (2D game or GUI).

Felipe R.
06-25-2009, 01:51 PM
Thanks for all the replies


Not clear what is SDL.

It's just a window manager. I will rephrase then: Opengl is not supposed to provide window management right? So if I am using window manager M and I want to use 2d graphics, should I use it with or without opengl for best performance?


For static stuff, display lists are the fastest[...]The thing is,... I've never seen 2D needing static stuff when textured rectangles need to be drawn for a scene (2D game or GUI).


I didn't mean to mix my two questions. One is about display Lists and saving calls with glDrawElements, etc. The other one is about my window manager and opengl

Stephen A
06-25-2009, 04:00 PM
OpenGL will give you significantly better performance than SDL's software renderer. The difference becomes vast once you start using textures and blending.

For 2d graphics, everything built over the last 8 years will be more than fast enough - display lists or not. Display lists tend to be faster than plain VBOs on static stuff, but VBOs are more flexible. If you need the flexibility, or if you wish to keep forward-compatibility with OpenGL 3.0+ then stick with VBOs; if not, use whatever feels more natural to you.

Felipe R.
06-25-2009, 05:15 PM
thanks

_NK47
06-26-2009, 01:27 AM
"which one is faster
to draw 2d graphics: plain SDL or SDL with openGL using ortho2d or something like that"
to make it more clear, in this case the one is faster which is hardware accelerated. here OpenGL "can be" HW accelerated if you have proper drivers and no Mesa3D override.

if you decide to use display lists use them to combine renderstate changes (blending, depth, etc).