PDA

View Full Version : Should I Use Immediate Mode for 2D Games ?



artariel
08-30-2013, 07:03 PM
Hello, I have started learning box2d physics engine which i will use for a 2D game which uses OpenGL as graphics API. The question is, since i can't use static vbos for very very dynamic objects, should I upload the coordinates on a shader or just use immediate mode for 2D graphics ? Will I get a performance hit if i don't use shaders to draw 2d objects ?

Alfonse Reinheart
08-30-2013, 08:03 PM
since i can't use static vbos

Buffer objects are only static if you want them to be. Dynamic buffer objects (https://www.opengl.org/wiki/Buffer_Object_Streaming) are an entirely legitimate use of them.

GClements
08-31-2013, 04:23 AM
Hello, I have started learning box2d physics engine which i will use for a 2D game which uses OpenGL as graphics API. The question is, since i can't use static vbos for very very dynamic objects, should I upload the coordinates on a shader or just use immediate mode for 2D graphics ?

You shouldn't use immediate mode for anything. Even client-side vertex arrays will be faster.

However, if you think that you might want to port the game to OpenGL ES at some point, then bear in mind that ES only supports VBOs, not client-side vertex arrays or immediate mode.

kyle_
08-31-2013, 06:00 AM
However, if you think that you might want to port the game to OpenGL ES at some point, then bear in mind that ES only supports VBOs, not client-side vertex arrays

That's incorrect. Client arrays are fine in GLES. Only desktop core ditched them.

menzel
08-31-2013, 07:31 AM
You shouldn't use immediate mode for anything.

+1
It's slow (except in some cases in combination with display lists), outdated and far from being future proof. Don't waste your time with the immediate mode, learn modern OpenGL instead.

artariel
08-31-2013, 12:20 PM
so i should use VBOs with dynamic mode. i heard it was a slow thing but i will try.

GClements
09-01-2013, 05:45 AM
That's incorrect. Client arrays are fine in GLES.
You're right of course

Only desktop core ditched them.
And WebGL (which is probably the source of my confusion).