Rendering 2D image to the screen

I’ve started learning OpenGL not a while ago, and now I wanted to draw a 2D Image (such as a “player”) onto the screen…

From a google search, I’ve seen the whole area is quite complicated, and I’ve seen I can “combine” OpenGL and another library (such as SFML or soil) to make it easier.
Can you recomend me a library to combine with OpenGL, to draw 2D images into the screen?

Or maybe it is not that hard, to draw 2D Image with OpenGL itself?

(If you’re giving an example of a good library to combine with OpenGL, I’d appreciate to see a “tutorial” for showing an image into the screen).


Drawing an image onto the screen is as simple as drawing a rectangle (=2 triangles) with a texture mapped on it.

Here is a tutorial chapter on texturing

Just so that you know… “as simple as” != “drawing a rectangle (=2 triangles) with a texture mapped on it”

What is that supposed to mean? Is it hard to draw a textured rectangle? Or do you have an alternative solution?

In case you are going to suggest the deprecated glDrawPixels, I tried that once with 10ish images and it got really, really slow (~5 FPS on a GTX285, without anything rendered yet, just the images).

In case drawing a rectangle is “hard”: it is drawn the exact same way as anything else in OpenGL®. In an application using deprecatd functions, the vertex data could come from glVertex* calls, in
a GL 3.1+ core profile application, the data comes from a VBO (which might contain other usefull primitives, not juse a rect). In both scenarios, you set up your transformation and projection
matrices propperly to make it 2D (when using the deprecated matrix stack, projection=identity, modelview=some 2D scaling of your choice; otherwise, you have to send the propper matrices to the
shader). Texturecoordinates are in the range [0,1] on both axes and texturing is done the same way as anything else.

If you can drawn something, drawing a rectangle is a matter of getting the vertices right. If you can texture something, texturing a rectangle is trivial. In fact, texturing a rectangle might
be the best starting point to experiment with texturing. If you managed to turn depth test on for your 3D scene, you already know how to turn it off, so your 2D overlay rectangle does not
interact with the 3D scene.