EdmondYap/Assignment 1

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

Control is passed back through callback functions. This is set up during initialization by passing function pointers to functions defined by the user (e.g. keyboard) to functions like glutDisplayFunc()/glutReshapeFunc()/glutKeyboardFunc().

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

The call to the function specifies our display mode- RGBA, in this case, and that we are using double-buffering (i.e. passing in GLUT_RGBA | GLUT_DOUBLE as the parameter).

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

As described in Chapter 2 (Redbook), glOrtho() specifies the coordinate system OpenGL will use to draw on. glViewport() adjusts the pixel rectangle for drawing to be the entire new window; it defines what 3d space is viewable.