View Full Version : Clicking on the screen.
I was wondering if there is an easy way to figure out where, in 3D a user clicked on the screen. I'm using GLUT, so I can easily get the actual (x,y) values, but I need to convert that into OpenGL numbers.
05-29-2001, 11:17 AM
If you've just clicked in your window at x,y then your coordinates in 3d space will be left_edge_of_vision + (x/window_width)*vision_width, bottom_edge_of_vision + (y/window_height)*vision_height. This is of course ignoring the 'depth' of your click since there wasn't any to be measured. http://www.opengl.org/discussion_boards/ubb/wink.gif
It might be time for you to review your algebra/trig. Good luck!
05-29-2001, 07:43 PM
If you are trying to get the depth of something you have already rendered, you could always try this-
tmpFloat will contain the depth(0.0-1.0) of wherever you clicked.
[This message has been edited by Sheepie (edited 05-29-2001).]
05-29-2001, 11:56 PM
do a search on picking in both forums...
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.