PDA

View Full Version : GLUT, How to add menu entries into the sub menu??



Asura
04-13-2006, 08:09 AM
Hi all:
How can I add menu entries into the sub menu? I went through the GLUT API reference. It introduced how to add menu entries and add submenu but didn't mention how to add entries into the submenu and how to catch that event. I tried several ways but no one works.
All the menu entries appear in the pop-up menu but not the submenu "sub1" in the following code.

void MenuSetting(){
int menu = glutCreateMenu(MenuFunc);
glutAddSubMenu("sub1", menu);
glutAddMenuEntry("Cylinder", CYLINDER);
glutAddMenuEntry("Torus", TORUS);
glutSetMenu(menu);
glutAddMenuEntry("Exit", EXIT);
glutAttachMenu(GLUT_RIGHT_BUTTON);
}
Could anybody tell me how to solve this please!
Thanks very much!!!

mikael_aronsson
04-15-2006, 07:27 AM
http://www.lighthouse3d.com/opengl/glut/index.php?11


DESCRIPTION
glutAddSubMenu adds a sub-menu trigger to the bottom of the current
menu. The string name will be displayed for the newly added sub-menu
trigger. If the sub-menu trigger is entered, the sub-menu numbered menu
will be cascaded, allowing sub-menu menu items to be selected.