Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

OpenGL contexts before and after OpenGL 3.0 are rather different. So far I've really only worked with buffers on either side anyway, I do know the most notable difference is lack of Immediate Mode.

Throwing out Immediate Mode considerations all together, what important differences should I look out for specifically when coding low-level two dimensional operations in a 2-D graphics engine?

share|improve this question
    
Answers so far have been helpful, however just a note: I am really more comfortable with GL3+ at the moment, and am thinking of back porting to 2.1 for compatibility. What matters the most is actually which version is going to be most compatible with OpenGL ES. –  Garet Claborn Jun 7 '11 at 19:14

2 Answers 2

up vote 6 down vote accepted

In terms of the contexts specifically, there's little difference. Most OpenGL implementations have most of the features of OpenGL 3.0+ even when using a legacy context, due to the way OpenGL extensions work.

If you're specifically asking about what features in OpenGL 3.0 are worth using, some of the best ones are geometry shaders and instancing, both of which are useful even for 2D graphics in certain circumstances. However, in most cases for simple 2D, all you're going to be doing is filling up a streaming vertex buffer every frame and making a single draw call, so there's really very little extra you're going to be doing.

In terms of 2D in OpenGL in general, just make sure you have a texture atlas (sprite sheet) so you very rarely need to change texture states. You want to avoid doing a draw call per sprite, as that is incredibly inefficient, and rather you want to batch together a lot of sprites and draw them all at once. Render with painter's algorithm, where "render" means pushing the geometry into a vertex buffer, and draw it at the end. Post-process as you see fit.

share|improve this answer

You can find a lot of information here: OpenGL registry. There is a lot of extensions. Each section (ARB, EXT, ...) are ordered according to adding date. New extensions are written against newer versions of OpenGL. For example - if I look at ARB section, almost every extension under ARB_timer_query (including) is written against OpenGL 3.2 or newer.

You also mentioned buffers, so you can try extension GL_NV_vertex_buffer_unified_memory. Some info can be found here (there is also link to presentation).

Also shader_buffer_load should be usefull, if you are using shaders, but I haven't read the specification yet.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.