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?

  • \$\begingroup\$ 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. \$\endgroup\$ – Garet Claborn Jun 7 '11 at 19:14
  • 2
    \$\begingroup\$ I'm curious to see why you rolled back the previous edit... \$\endgroup\$ – Vaillancourt Jul 13 '17 at 10:12
  • \$\begingroup\$ that's because this title is referencing a specific major shift in OpenGL core methodology. prior to version 3, OpenGL architecture was deeply tied to the OpenGL 1.1 and 1.0 architecture. The reason this is a significant point in OpenGL history/method is domain specific to OpenGL. After this version backward compatibility is broken for the first time since 97 or so. It's also a major schism in terms of making the standard more practical for modern hardware. It's important for the meaning of this question that it represent this break in the architecture. \$\endgroup\$ – Garet Claborn Jul 18 '17 at 3:40

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.


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.


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