   gluUnProject with orthogonal projection
  Hi all,I am new to this forum. I am using the following method to get a ray. This method works fine for perspective projection. But not for the orthogonal projection. I dont know how to handle orthogonal projection.if I replace 0.9 with 1.0 in the following line, both projections give bad results.gluUnProject((double) x, dClickY, 0.9, mvmatrix, projmatrix, viewport, &dX, &dY, &dZ;void Unproject(int x, int y, Point3D& pt1, Point3D& pt2){double mvmatrix[16];   double projmatrix[16];   int viewport[4];   double dX, dY, dZ, dClickY;   glGetIntegerv(GL_VIEWPORT, viewport);   glGetDoublev (GL_MODELVIEW_MATRIX, mvmatrix);   glGetDoublev (GL_PROJECTION_MATRIX, projmatrix);   dClickY = double (viewport[3] - y);    glEnable(GL_DEPTH_TEST);   gluUnProject((double) x, dClickY, 0.1, mvmatrix, projmatrix, viewport, &dX, &dY, &dZ;   pt1.Reset((float) dX, (float) dY, (float) dZ );   gluUnProject((double) x, dClickY, 0.9, mvmatrix, projmatrix, viewport, &dX, &dY, &dZ;   pt2.Reset((float) dX, (float) dY, (float) (dZ));}Can anyone correct this problem?   
  I didn't see any obvious errors in your code, and I'm not sure why using a z value of .9 would give you incorrect results in both cases.For what it's worth though, I can confirm that the method you're using works correctly for both perspective and orthographic transforms (IMX, at least). I know that's probably not much help - maybe someone else will be able to spot the problem for you.   