PDA

View Full Version : Dynamic menus on GLUT



Hec
06-05-2002, 01:39 PM
Hi ! all

Here is my problem, i have different objects on scene (disks, triangles, rectangles, ...), each has different properties, and i want to click on one of the objects, and build a glut menu with the properties of the object clicked, and show the popup menu.
I, already, detect wich object was clicked so i need to know how to create the popup menu and show it.

I think it can be done, because GLOW does it, i tried to follow GLOW's code but i couldn't find it quit well.

Any help would be appreciated

jmathies
06-07-2002, 08:00 PM
Originally posted by Hec:
Hi ! all

Here is my problem, i have different objects on scene (disks, triangles, rectangles, ...), each has different properties, and i want to click on one of the objects, and build a glut menu with the properties of the object clicked, and show the popup menu.
I, already, detect wich object was clicked so i need to know how to create the popup menu and show it.

I think it can be done, because GLOW does it, i tried to follow GLOW's code but i couldn't find it quit well.

Any help would be appreciated

You can use the GLUT menu commands to
create mutliple menus and then swap them
out via glutAttachMenu.

Here's the api from the glut header:
GLUTAPI void APIENTRY glutDestroyMenu(int menu);
GLUTAPI int APIENTRY glutGetMenu(void);
GLUTAPI void APIENTRY glutSetMenu(int menu);
GLUTAPI void APIENTRY glutAddMenuEntry(const char *label, int value);
GLUTAPI void APIENTRY glutAddSubMenu(const char *label, int submenu);
GLUTAPI void APIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
GLUTAPI void APIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
GLUTAPI void APIENTRY glutRemoveMenuItem(int item);
GLUTAPI void APIENTRY glutAttachMenu(int button);
GLUTAPI void APIENTRY glutDetachMenu(int button);

There are docs around for GLUT as well.
Try searching Google.
Regards,
JIm



[This message has been edited by jmathies (edited 06-07-2002).]