What should I get with this code?

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 think your error is in glReadPixel…

you pass in a 2-dimensional array, but he only wants to write into a single varible (of FLOAT)

glReadPixel(x,y,1,1,GL_RED,GL_FLOAT,pixels[0][0]);

might be a solution for your problem

Erm - not sure about that above:

glReadPixel(x,y,1,1,GL_RED,GL_FLOAT,&pixels[0][0]);

or perhaps,

GLfloat Pixel;

glReadPixel (x,y,1,1,GL_RED,GL_FLOAT,&Pixel );

I solved it.
The problem is OpenGL doesnt use OpenGL coordinate for this matter, but Viewport coordinate (aka x window coordinate, height - y coordinate).