The following 125 words could not be found in the dictionary of 615 words (including 615 LocalSpellingWords) and are highlighted below:

accomplish   advanced   an   and   Answers   aspect   Assignment   assignment   available   back   based   be   behavior   bitwise   buffering   but   by   callback   called   calls   color   command   commands   complete   Control   control   convenient   coordinate   define   Display   does   don   double   draw   during   etc   events   fixed   flags   for   Func   Funcion   function   gl   glut   How   how   however   If   in   In   Init   initialization   integer   keep   keyboard   lets   library   main   matrix   might   Mode   more   mouse   namely   need   new   number   of   on   one   only   onto   operations   options   or   Ortho   our   parameter   passed   pointer   pointers   portion   possible   program   programmer   ratio   reshape   resize   resized   scheme   selected   selection   set   several   Single   size   specifies   specify   such   system   taking   The   the   then   There   This   this   to   transforms   up   us   used   using   via   Viewport   want   we   well   What   which   whole   why   window   writing  

    JosephBonneau/Assignment1

Assignment 1 Answers

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

Control is passed back via a callback function which is passed as a parameter (namely a C++ function pointer) to the function glutDisplayFunc(). This function is then called by the GLUT library code after initialization is complete. Funcion pointers are also used to specify behavior on window reshape, keyboard, and mouse events.

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

There is only one parameter, an integer, but it is used to specify a number of initialization options by taking the bitwise-OR of several possible flags. Single or double buffering is selected by using the GLUT_SINGLE or GLUT_DOUBLE commands. The color selection scheme is selected using GLUT_RGBA or GLUT_INDEX. There are more advanced flags available as well such as GLUT_ACCUM, GLUT_ALPHA, GLUT_STEREO, etc. which we don't need for Assignment 1.

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 glViewport() function specifies which portion of the window we which to draw to, in the assignment we want to draw onto the whole window. The glOrtho() command specifies a matrix which transforms the coordinate system. This lets us define our coordinate system however it is convenient for the program we are writing. If the window is resized, we may want to change the coordinate system based on the new window size, this lets us keep the aspect ratio or size fixed during resize operations.

Recent