COEN 290 List of Frequently used GLUT Functions

This is just a quick list to get you started writing glut programs. You should look at the on-line GLUT documentation for more details.
glutInit()
Initializes glut. It takes pointers to argc and argv, so it can parse glut command line arguments.
glutInitWindowSize()
Sets the size of the window that glut will open
glutInitDisplayMode()
Describes the features the window should have, such as RGBA or CI, Double buffering, Z-buffering, etc.
glutCreateWindow()
Opens a Glut window. You should have already described the window size and window features you wanted. You can give this function a string describing the program the appears in the window header.
glutDisplayFunc()
Gives glut a function to call when the window needs to be redrawn. This is used when the window comes up, and when the window is re-exposed.
glutReshapeFunc()
Gives glut a function to call when the window changes size or shape. You should at least call glViewport(), and also update any transforms that need updating. If your tranforms don't need to know the window size or you have only one viewport in the windo, then you probably don't need this function. If you don't specify one, glut has a default reshape function that calls glViewport() when the window changes size.
glutIdleFunc()
Gives glut a function to call when it's not busy doing something else (ie processing input). The function called can be doing animation.
glutMouseFunc()
Gives glut a function to call when a mouse button is pushed or released in the window. The function gets the mouse position (remember, glut uses the upper left corner of the window for the origin; y increases downward), the button pressed, and whether the button is down or up.
glutKeyboardFunc()
Gives glut a function to call when a key is pressed in the window. It is given the key value
glutCreateMenu()
Useds to start making a glut menu, that can be brought up by clicking with the mouse. The function given is called with one of the values in the menu.
glutAddMenuEntry()
Add a menu entry to the current menu. Call this for each menu entry you want. You give it a string and a number. The number is given to the menu callback function when it is called.
glutAttachMenu
Attach the current menu to the mouse button specified.
glutMainLoop
call this after you've done all your other glut calls. This function never returns until the program exits. It starts running the event loop.