My program is a simplified version of Pong. It has two paddles and a moving ball that is built by drawing 360 short lines. A number of constants that control the way the game is played can be found at the top of my code. It has a rudimentary score keeping system as well as very basic output functionality.

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

Control is passed back to the programmer through callback functions that are registered during the initialization of the program. The Programmer must register these callback functions in main. In this program, calls to glutDisplayFunc, glutReshapeFunc, and glutKeyboardFunc, with the appropriate function pointers represent this setup. The function pointers passed to these callback functions are the functions that are called when the appropriate event occurs.

Question 2: What does the parameter to glutInitDisplayMode() specify?

The parameter to glutInitDisplayMode specifies the display mode for windows created when glutCreateWindow() is called. The display mode is a combination of color model (GLUT_RGB, GLUT_RGBA or GLUT_INDEX) and buffering (GLUT_SINGLE, GLUT_DOUBLE) options.The parameter is a bit-wise or combination of flags that allow programmers to choose which options they want for their program.

Question 3: What do the calls to glOrtho() and glViewport() accomplish? If the window is to be resized, why might we want to change this?

glOrtho defines the three dimentional coordinate system that the window will have. The input to glOrtho represent the faces of the clipping planes which our program will use. Meanwhile, glViewport specifies the drawing region. It specifies the lower left corner and the width and height of the region. In this assignment, we want to draw on the entire space available. If the window is resized, we might want to alter the coordinate system (through glOrtho) in order to maintain the current aspect ratio or the absolute size of objects fixed during the resize operation.