Sign in to follow this  
apocalypse_k40

Problem with cursor position

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this