3d Mouse Coordinate Calculation

Started by
1 comment, last by mmakrzem 18 years, 4 months ago
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
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.
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?

This topic is closed to new replies.

Advertisement