So I know that glDrawPixels is deprecated. Is there any function that does the same thing? I thought of using textures, but they are modified by the current matrix, unlike pixels that are drawn by glDrawPixels.
-
By the way, even if `glDrawPixels` is available or not deprectated (on GL 2-), don't use it, but instead always use textured quads for those purposes. `glDrawPixels` has been deprecated for a reason. – Christian Rau Aug 23 '12 at 14:25
3 Answers
I thought of using textures, but they are modified by the current matrix
The "current matrix" is deprecated in 3.0 and removed in 3.1+ as well. So if you're not using glDrawPixels
, you wouldn't be using matrix functions either. So it's nothing to be concerned about.

- 449,505
- 63
- 781
- 982
-
Okay. What I meant to say is that textures look different when the camera moves, and that's something I don't want. – Pilpel Aug 22 '12 at 12:25
-
1
-
1@Pilpel They may only look different if **you yourself** use some shader that makes them look different (by using some inappropriate matrix transformations). So just don't transform them depending on the camera, that easy. OpenGL won't free you from actually using the right setup for the right primitives, so don't draw a screen-sized quad using vertex blending and shadow mapping. – Christian Rau Aug 22 '12 at 12:42
You could use a fragment shader where a function of gl_FragCoord
is used to sample a rectangular texture.
Alternatively, you could use a more traditional approach and just set up your transformation matrices to approximate the pixel coordinate system of your window and then draw a textured quad with your image.

- 2,262
- 15
- 18
You need to draw a quad with :
- A specific ModelViewProjection Matrix which will place it where you want (as Nicol said, there is no "current" matrix anymore)
- A simple vertex shader which will use said Matrix to actually transform the vertices
- A simple fragment shader which will sample the texture
- And of course, adequate texture coordinates.
For starters, use an Identity matrix, and a mesh with X and Y coords between 0 and 1.
You might want to use a mix of http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/ and http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-11-2d-text/ (though the latter one should be improved regarding the matrix used)

- 9,413
- 2
- 44
- 55