I noticed that there is quite some difference between 3D and 2D rendering using OpenGL, the techniques are different - pixel-perfect placing is a lot more desirable, among other things.

Are there any good (complete) references on using OpenGL for rendering 2D graphics? There are quite a few "tutorials" around on the net that help you open a window, set up a half-decent environment and draw a sprite, but no real good information on rotation, blending, lightning, drawing order, using the z-buffer, particles, "complex" primitives (circles, stars, cross symbols), ensuring pixel-perfect rendering, instancing and many other staple 2D effects/techniques.

Any books, great blogs, anything? Any particular awesome libraries to read?


2 Answers 2


OpenGL 2D and 3D rendering is almost same except few things:

  • Orthographic projection instead of perspective projection. There is no problem pixel-perfect placing if your ortho has same width,height as your window have.
  • Usage of 2D vertices, unless you aren't drawing 3D things in 2D projection
  • 2D rendering is a lot of simpler 3D

Everything else is same - pipeline, shaders, texturing, buffers.

Resources you would probably like:

  • GPWiki - category OpenGL - basics about OpenGL, window creation, input,...
  • NeHe Productions - good step-by-step tutorials about OpenGL, almost everything is presented using 3D objects, but a lot of is applicable in 2D rendering
  • Lighthouse3D.com - GLSL - tutorials about OpenGL Shading Language. Like in NeHe, they are presented using 3D objects, but GLSL is usable for 2D, too. It's very easy to create nice effects with it.
  • 5
    \$\begingroup\$ Most NeHe tutorials are horribly outdated, concentrating on the deprecated OpenGL 1.x and as should be given a well earned but long overdue retirement. \$\endgroup\$
    – Tapio
    Commented Jul 1, 2012 at 20:56

Have you read the OpenGL red book? Check out chapter 2 and 8.


Not the answer you're looking for? Browse other questions tagged .