PDA

View Full Version : selection and picking



KlaHyMan
05-16-2000, 12:22 PM
I need to let the user pick up objects with the mouse pointer. How can I do that? Is it necessary to use selection/picking? If so, how can I use them? (my objects are rendered as display lists).
Thanx!

05-16-2000, 01:38 PM
Hi,

You dont have to use the OpenGL selection mode, but it's easier and more practical when it's done. However, if your objets are in a 2D plae, you can simply define a "box" around your object and check if your mouse click falls insisde that box, using gluUnProject() (to change from window to world coordonates).
If you want OpenGL to find them for you, use the GL_SELECT mode, with gluPickMatrix()...if you would like some code example ('cause it's not obvious http://www.opengl.org/discussion_boards/ubb/frown.gif ), let me know...

Marc.
marc.simard@polymtl.ca