Problem with cursor position

Started by
0 comments, last by Caste 17 years, 1 month ago
Hello everyone, I wrote this thread also in the openGL form. I think that also this form may help. If double threads are problem sorry. The mod can delete this thread. My problem is with getting the cursor position. I draw a quad with all vertex have a z value 0.25 and othe vertex values are (-1.0,-1.0) to (0.0,0.0). But when I click on the object I get cursor values (0 to 640, 0 to 480) which means the actual screen position. So a hit never happens when I try to make a selection. What can I do to solve this problem. PS : I use C#/CsGL and tried to understand the 32nd tutorial which is about selections. Thanks in advance and best regards.
Advertisement
There are several ways to achieve picking, on the one hand you could use the method of picking described in the NeHe tutorials, but what you intend to do seems more like you want to transform screen coordinates (what you have for your mouse) to world space (your quad).
The latter one can be achieved by using gluUnproject (just google for it or take a look at http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/glu/unproject.html)

This topic is closed to new replies.

Advertisement