View Full Version : How to associate a function to a drawable object?
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.
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).
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.