next up previous
Next: Callbacks: Up: OpenGL Quick Reference Guide Previous: Basic Information

Initializations:

The following procedures are typically invoked once in the main program, before the graphics processing begins.

glutInit(int *argcp, char **argv):
Initialize GLUT and OpenGL. Pass in command-line arguments.
glutInitDisplayMode(unsigned int mode):
Set GLUT's display mode. The mode is the logical-or "|" of one or more of the following:
Select one of the following three:
  • GLUT_RGB: use RGB colors.
  • GLUT_RGBA: use RGBA colors.
  • GLUT_INDEX: use color-mapped colors (not recommended).
Select one of the following two:
  • GLUT_SINGLE: use single-buffering.
  • GLUT_DOUBLE: allow double-buffering (for smooth animation).
Select the following for hidden surface removal:
  • GLUT_DEPTH: allow depth-buffering.
There are a number of other options, which we have omitted. This last option make depth-buffering possible. It is also necessary to enable the operation (see glEnable() below).
glutInitWindowSize(int width, int height):
Set the initial window size. Also see: glutInitWindowPosition().
glutCreateWindow(char *title):
Create window with the given title (argv[0] sets the name to the program's name).
glutMainLoop(void):
This starts the main event loop. Control returns only through one of the callback functions given below.

Please report any errors or send comments to Dave Mount

Last updated: Sat, Feb 8, 2003.