Can someone help me,
I have a problem when I try to get the origin of an object in world space coordinates.
For example I have a sphere wich moves along Y axis, parallel to it (x = 0, z = 0, Z means UP, Y means DEPTH)
The projection is perspective :
gluPerspective(70.0, (float)w / (float) h, 0.08, 4.0);
Camera position is defined as follows:
gluLookAt(0.0, -0.2, 0.25, 0.0, 0.3, 0.0, 0.0, 0.0, 1.0);
I get the sphere’s center location using the following code :
glGetDoublev (GL_MODELVIEW_MATRIX, modelviewMatrix);
x = modelviewMatrix;
y = modelviewMatrix;
z = modelviewMatrix;
When the sphere’s center Y value becomes less then 0, Z value of the sphere’s center starts to decrease. Nevertheless the sphere continues to move parallel to the Y axis.
The problem is why Z value changes ?
Another point is when I change the position of the camera (Z value) I receive different values for x,y and z, despite the object location is the same.