View Full Version : How to associate a function to a drawable object?

05-14-2003, 10:00 PM
There are many drawable objects on my display. I would like my program to call a function when one of the polygons is selected.

How to make a polygon selectable and associate a function to it? Obviously I am new here.


05-15-2003, 01:36 AM
For selection, have a look at OpenGL's selection mode.

For calling a function based on selection, it depends on language. Since you didn't mention any language I'm going to assume C++. You can map OpenGL's selection names to a function pointer using map or vector.

Here's (http://biology.ncsa.uiuc.edu/library/SGI_bookshelves/SGIindex/SGI_Developer_OpenGL_PG.html) a link for selection (among other things).