I am using gluProject() to find the screen coordinates of a point in 3D space so that I can place some text on the screen in the correct position.
the code I am using is
double ModelViewMat[16], ProjMat[16], winX, winY, winZ;
int Viewport[4], intX, intY;
glGetDoublev(GL_MODELVIEW_MATRIX, ModelViewMat);
glGetDoublev(GL_PROJECTION_MATRIX, ProjMat);
glGetIntegerv(GL_VIEWPORT, Viewport);
gluProject(10.0, 10.0, 0.0, ModelViewMat, ProjMat, Viewport, &winX, &winY, &winZ);
intX = (int) winX;
intY = (int) winY;
The values I get back in intX and intY are sort of correct but a little off the mark.
I am not changing the values of the point in 3d space but I am changing the values with gluLookAt().
The data in the ProjMat is not changing and the data in the ModelViewMat is changing which is expected.
It seems as though there is a scaling factor
effecting the data somehow.
Can any one help me out
Thanks