It might be a very naive question but i am a bit stuck.
I am writing my first opengl programme and I want to pick up the R value of a pixel, of a point that i got from mouse click.
I am clueless about how to use glReadPixels function.
void myMouseFunc( int button, int state, int x, int y ) {
if ( button==GLUT_LEFT_BUTTON && state==GLUT_DOWN ) {
glReadPixels(x,y,0.1,0.1,GL_RED,GL_INT, pixel);
glutPostRedisplay();
}
}
The documentation is pretty clear:
http://www.opengl.org/sdk/docs/man/xhtml/glReadPixels.xml