2/15/2012

(TIP) To get Color Information of specific pixel coordinate in the OpenGL

The method is simple to to get Color Information of specific pixel coordinate in the OpenGL is simple.
glReadPixels function enables these task.
The example source code is as follows.

struct{ GLubyte red, green, blue; } pixelColor;
glReadPixels(int(i), int(j), 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &pixelColor);

But the drawback is too slow and we can get exact color information after view rendering.
Thanks.