• Homework 1:

1) Question 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 a variety of event handlers, such as glutDisplayFunc (which allows you to programmably configure the display) or glutSpecialFunc (which provides a keyboard handler for special keys such as F1, up, down..), etc, etc. During initialization, function pointers are assigned to these events, and when glutMainLoop() is called, the program will wait until these events are triggered.

2) Question 2: What does the parameter to glutInitDisplayMode() specify? //glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE ); GLUT_RGBA specifies a 32 bit color schema in which 8 bits specify the amount of red, 8 bits the amount of green, 8 of blue, and the last 8 for the degree of transparency. GLUT_DOUBLE specifies that the display will be double buffered, ie, there will be two buffers for the display that can switch back and forth during animation for more seamless movement.

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

glOrtho() specifies the allowable viewing area. The 6 coordinates (arguments) specify the sides of a viewing cube outside of which all objects are clipped. In some sense, it provides a mapping of window coordinates to the OpenGL 3d coordinates. In this case, it resets the viewable area. glViewport() resets the window's coordinates to the appropriate size. If this call is missing, the window will not resize.