Search code examples
iphoneopengl-es

glReadPixels() in OpenGL ES?


If I write:

glColor4f(1.0,0,0, 1.0);
glReadPixels(touch1Point.x,viewport[3]-touch1Point.y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixelColor[0]);

...pixelColor is populated with RGB(255, 0, 0)

What is the right glReadPixels() call that will give me back RGB(1.0, 0, 0)?


Solution

  • Divide each component of pixelColor by 255.0f