jtipton

04-04-2007, 11:26 AM

I realize this topic has been exhausted. I searched each of the Developer forums for other instances of this topic. Each one seems to give different information, so I am looking for a conclusive answer. I am converting mouse coordinates to world coordinates using code like this:

float Z;

glReadPixels(X, Y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &Z);

gluUnProject(X, Y, Z, MV, PR, VP, &WX, &WY, &WZ);This works on some systems, but not on others. The value of Z differs with the platform. This difference is by many orders of magnitude, which results in entirely different world coordinates. So here are the questions:

1. Is the differing Z value caused by a driver bug, or was it intentionally left to the GL vendor?

2. Given the same application and mouse coordinates, can I expect comparable Z values to be read from the depth buffer? I realize they will not be "exactly" the same due to floating point arithmetic.

3. Since it is inconsistent, what else can be done to get the correct depth value?

Any help is greatly appreciated.

float Z;

glReadPixels(X, Y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &Z);

gluUnProject(X, Y, Z, MV, PR, VP, &WX, &WY, &WZ);This works on some systems, but not on others. The value of Z differs with the platform. This difference is by many orders of magnitude, which results in entirely different world coordinates. So here are the questions:

1. Is the differing Z value caused by a driver bug, or was it intentionally left to the GL vendor?

2. Given the same application and mouse coordinates, can I expect comparable Z values to be read from the depth buffer? I realize they will not be "exactly" the same due to floating point arithmetic.

3. Since it is inconsistent, what else can be done to get the correct depth value?

Any help is greatly appreciated.