Chapter 11. Picking Objects in 3-Space

 

You don’t resign from these jobs, you escape from them.

 
 --Dawn Steel

Manipulating OpenGL Objects

It’s possible to let the user select an object in an OpenGL view. It’s not terribly difficult once you’ve done it; it’s just a matter of understanding the steps you have to go through. Using the mechanisms provided in OpenGL, you’ve got some viewport coordinate, typically the location of the cursor when the user clicks a mouse button, but it could also be input from a joystick to a SpaceBall. The point is you’ve got some coordinates from the user. You then change the rendering mode of OpenGL, define the area of interest, let OpenGL see whether anything was drawn in that area, and then fetch the list of objects ...

Get OpenGL Programming for Windows 95 and Windows NT now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.