i want to fix the position of the mouse ,so i use the gluUnproject function.here is my program:
y = viewport - point1_y;
glReadPixels(point1_x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &fWindowZ);
gluUnProject((GLdouble) point1_x, (GLdouble) y, (GLdouble) fWindowZ,dmatModelview, dmatProjection, viewport,&dWorldX, &dWorldY, &dWorldZ);
printf("(%f, %f, %f)
after running ,a sphere will be drawn rightly at the mouse position.but what i am so confused is that the output coordinates are always positive wherever i press my mouse button.how to explain this?
thank you very much!