Original Post
Here's my code: POINT pt; pt.x = LOWORD(lParam); pt.y = HIWORD(lParam); GLint vport[4]; GLdouble modelview[16]; GLdouble projection[16]; GLfloat winX, winY, winZ; GLdouble posX, posY, posZ; glGetDoublev( GL_MODELVIEW_MATRIX, modelview ); glGetDoublev( GL_PROJECTION_MATRIX, projection ); glGetIntegerv( GL_VIEWPORT, vport ); winX = pt.x; winY = vport[3] - pt.y; glReadPixels( winX, winY, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ ); gluUnProject(winX, winY, winZ, modelview, projection, vport, &posX, &posY, &posZ); My problem is whatever mouse coord I input for winX, winY, I get those back in posX and posY. Ex. winX = 127, posX = 127.0001 winY = 54, posY = 54.00042 Anyone see what I'm doing wrong? I've been trying this for a day or two and read most of the posts about gluUnProject and cannot figure out what is wrong.