CS148 AssignmentOne Greg Goldgof Due: January 18, 2007

Assignment One Answers

Read up on OpenGL and GLUT and answer the following questions. Be sure you can answer all these questions before moving on.

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 via function pointers. The glut functions

and others take function pointers as parameters during initialization. These functions are provided by the programmer, so that he/she can control what is displayed, how reshaping works, how the program responds to keyboard input, how it updates, et cetera.

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

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?

Program Operation

Notes on program: Press “space” to get the squares to change direction. Press ‘f’ to toggle double-time (fast). Press ‘t’ to make the triangle appear or disappear. Press ‘c’ for a color change. Press ‘p’ for psychedelic mode. Press “escape” to exit.

To change the starting positions of the polygons and therefore the relationship between their rotations use the following keys. Press ‘r’ to reset back to original positions. ‘w’ = up ‘s’ = down ‘d’ = right ‘a’ = left


CategoryHomepage

last edited 2007-01-17 22:27:37 by peach