GLfloat pixels[1][1];
glReadPixels(x,y,1,1,GL_RED,GL_FLOAT,pixels);
if(pixels[0][0]==(float)w) MessageBox(“We have a customer !!”);
x and y are the glCoordinates pointed by the mouse. Only problem is wherever I click, the value of the pixel still equals w…
What should be stored within pixels in my code?
I solved it.
The problem is OpenGL doesnt use OpenGL coordinate for this matter, but Viewport coordinate (aka x window coordinate, height - y coordinate).