Reading Pixels from buffer

I am having problems trying to read pixel data from the back buffer. The code I have is returning all 0’s in my pixel array. Here is a bit of my code.

First I initialize all my arrays

glDrawArrays(GL_QUADS,0, NUMSURF*4);

When I look at bits I am always getting 0’s
Any help would be great. I know that I am drawing correctly because when I swap the buffers after this I can see what I am trying to read into bits.


I’m guessing that you have an RGBA, not a color index, visual. Replace GL_COLOR_INDEX with GL_RGBA…

Also, check glGetError() (or use glutReportErrors in a GLUT app). If you’re not getting a result, more than likely an error is occurring.

  • Matt