Jump to content
  • Advertisement
Sign in to follow this  
gashad

(x,y) screen (x,y,z) world coordinates?

This topic is 4100 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm coding up a simple mesh editor as a demo app for a mesh deformation algorithm I'm implementing... My program currently draws a mesh as wireframe with spheres at every vertex. I want the user to be able to select individual vertices of an arbitrary mesh and move them around with the mouse. What is the best practice for this? The Red Book and NeHe have sections on "picking" and selection modes... It seems like these /should/ work... I just want something that will be fairly easy to code up and will work reasonably well. Is picking the best way of providing a mechanism for the user to edit a mesh? If not, what are some other ways of converting from (x,y) screen coordinates to (x,y,z) world coordinates? Thanks! -Pete

Share this post


Link to post
Share on other sites
Advertisement
Or look into gluUnProject:


glGetIntegerv(GL_VIEWPORT, viewport);
glGetDoublev (GL_MODELVIEW_MATRIX, mvmatrix);
glGetDoublev (GL_PROJECTION_MATRIX, projmatrix);
gluUnProject (MouseX,MouseY,MouseZ, mvmatrix, projmatrix, viewport, &WX,&WY,&WZ);


Get MouseZ by glReadPixels().

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!