PDA

View Full Version : Getting screen coordinates



LeoTS
11-24-2004, 02:38 PM
I am having problems relating the screen dimensions (GLfloats) to what the mouse is reporting for position. I can tell the origin is in the middle of the screen, but how do you the the active bounds for the floats? I have tried glGetDoublev(GL_VIEWPORT, dVal), but it returns the same information the mouse reports. Any suggestions?

Thanks,
Leo

dvm
11-24-2004, 03:39 PM
I believe you should take a look at gluUnproject.
Given viewport, modelview, projection matrices etc. it gives you back the point you clicked from window coordinates to world coordinates. For the opposite I think it's gluProject. Try finding the examples of the aforementioned function in the Red Book (OpenGL Programming Guide)