Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Open GL selection Question...

This topic is 6611 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

Hi everybody! I''m trying to make a 3D modelling program in Open GL. And my problem is that i can''t select vetices on the screen using the mouse. What i want to do is, convert the mouse coordinates to a vertex so i can compare that vertex with all vertices in the 3d object. And if it is a close match to any vertex in the 3d object then that vertex will be selected. You know what i meen... This is the code im working with... It seems to work when I scale my 3d object but it does not work when i have rotated my object. Why? glGetDoublev( GL_PROJECTION_MATRIX, projectionMatrix ); glGetDoublev( GL_MODELVIEW_MATRIX, modelviewMatrix ); glGetIntegerv( GL_VIEWPORT, viewport ); gluProject( x, y, z, modelviewMatrix, projectionMatrix, viewport, &winX, &winY, &winZ ); gluUnProject( mouseX, mouseY, winZ, modelviewMatrix, projectionMatrix, viewport, &x, &y, &z ); // Thanx, Peter....

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!