I am trying to use glReadPixels to determine the RGBA value of a single pixel. However, glReadPixels seems to return junk. Is there a better way to do this? Here’s my current code:
Read pixels uses the current glReadBuffer setting. For double buffered pixelformats that’s the backbuffer. You probable want to read from GL_FRONT.
If the color buffer you read from is fixed point, using floating point target will scale the values to the range 0.0 to 1.0.
OpenGL’s coordinate system is bottom left. If "center"is in Windows’ coordinates you need to invert the y-value.