Next: Display lists:
Up: OpenGL Quick Reference Guide
Previous: GLUT Utilities for Complex
GLUT Menu Functions
GLUT provides a simple mechanism for creating pop-up menus. Each menu
is associated with a procedure (which you provide) when you create the
menu. When the menu item is selected, this procedure is called and
passed the index of the item selected. Submenus are also possible
(but not discussed here).
- glutCreateMenu(void (*)(int)):
-
Creates an empty menu. The argument is the callback function,
which is of the form void myfunc(int value), where
value holds the index of the menu item which was selected.
- glutAddMenuEntry(char *name, int value):
-
Adds a menu entry to the bottom of the current menu. The
character string name is the text to be displayed in the
menu entry, and the integer value is passed to your
callback procedure to identify the selected item.
- glutAttachMenu(int button):
-
Attaches the current menu to the specified mouse button, which
is either GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON,
or GLUT_RIGHT_BUTTON.
Please report any errors or send comments to
Dave Mount
Last updated: Sat, Feb 8, 2003.