To add entries to a menu, we must first use the menu's identifier to set it as the current menu. Next, we add entries to the menu. The first entry is our submenu, which we add through a call to glutAddSubMenu. The first parameter passed to the function is "Set Color", which appears as a user choice when the main menu appears. The second parameter is the submenu's identifier.

The next two entries are added as simple choices through calls to the GLUT function glutAddMenuEntry. The first parameter passed to the function is the name of the choice and the second paramenter is an integer that identifies the choice. GLUT will pass the integer to our handler if the user chooses this menu item. We see that the integers provide the means for knowing which choice the user made.

Note that the menus are popup, triggered by a mouse click. In turn, we attach the menu to one of the mouse buttons. We see here that the menu is attached to the right button.