1. In a GLUT program, how is control passed back to the programmer? How is this set up during initialization?

Control is passed to the programmer in the form of callback functions (functions that will be called when events occur, e.g. when the window needs to be drawn or when a key is pressed). This is set up during initialization through calls to functions such as glutDisplayFunc, glutReshapeFunc and glutKeyboardFunc. Each of these functions takes as an argument a function pointer indicating the function to be called when that event occurs.

2. What does the parameter to glutInitDisplayMode() specify?

The mode parameter controls options such as the color model (GLUT_RGB, GLUT_RGBA or GLUT_INDEX) and buffering of color buffers (GLUT_SINGLE or GLUT_DOUBLE). The value passed is a logical OR of these options.

3. What do the calls to glOrtho() and glViewport() accomplish?

glOrtho() defines a clipping window, i.e. a mapping between a relative coordinate frame and the pixels displayed on-screen. For example, the call glOrtho(-1., 1., -1., 1., -1., 1.) indicates that a vertex at position (-1, -1) should be drawn in the lower-left corner of the window, and that a vertex at (1, 1) should be drawn in the upper-right.

glViewport() allows us to use only part of the window as the "drawing canvas." Its parameters (in pixels) indicate which rectangular area should be used.