Jump to content
  • Advertisement
Sign in to follow this  
Colfax

OpenGL 3d Mouse Coordinate Calculation

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

If this has been covered elsewhere just let me know and delete this, I couldn't find it. I need to find where on a 3d surface, my mouse pointer is at. I'm using OpenGL and SDL for portability with my program. I have a number of blocks on the screen, and I need to be able to tell which of them the mouse is over. Any help or direction you can provide would be greatly appreciated. Thanks. -Colfax

Share this post


Link to post
Share on other sites
Advertisement
This has in fact been covered a number of times recently, but I don't know where the threads are. I would try googling 'opengl picking' though, as that should lead you to a couple of good tutorials on the subject. The two most common ways of doing this are a) a picking matrix and OpenGL feedback mode, and b) creating a picking ray using gluUnproject() and intersecting it with your objects. You should be able to find info on both these methods online.

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
This has in fact been covered a number of times recently, but I don't know where the threads are. I would try googling 'opengl picking' though, as that should lead you to a couple of good tutorials on the subject. The two most common ways of doing this are a) a picking matrix and OpenGL feedback mode, and b) creating a picking ray using gluUnproject() and intersecting it with your objects. You should be able to find info on both these methods online.


Is there a similar way to handle picking objects in 3D when using DirectX?

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!