DanielBauman

Daniel Bauman's CS148 Page

Email: <dbauman AT SPAMFREE stanford DOT edu>

Assignment 1:

NOTE: In my program, press the <Enter> button repeatedly to continue the program.

Writeup

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

Control is passed back by giving the programmer the ability to give call-back functions. During initialization, methods including glutDisplayFunc(), glutReshapeFunc(), and glutKeyboardFunc() take functions as parameters, and then call them at the appropriate time. Once they are called, the programmer's code is run.

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

It specifies any display modes that the user wants. In this case, the GLUT_RGBA means that specific color scheme, and the GLUT_DOUBLE means to use double buffering.

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?

The glOrtho() call specifies the orthographic view of the window - meaning how the coordinates are set up, and what perspective to use. The glViewport() determines what part of the coordinate system the actual window pertains to. If the window is resized, we might also want to resize (or might not want to resize) the shapes onscreen, and this can be specified through these methods.


CategoryHomepage

Recent