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

absolute   accomplish   add   affine   along   already   altered   an   and   argument   arguments   aspect   back   be   become   between   bit   bitwise   blue   buffered   buffering   by   callback   calling   calls   can   canvas   changes   circle   clipping   colors   Control   control   coordinate   coordinates   corner   corresponding   cross   default   device   Display   display   does   double   drawn   draws   drew   during   enter   establishes   event   events   example   executed   final   for   from   Func   function   functions   get   gl   glut   green   handlers   happens   height   How   how   However   If   image   in   In   ing   Init   initial   initialization   input   int   keyboard   Keyboard   left   Let   lower   main   maintain   mapped   mapping   masks   meaning   might   mode   Mode   more   My   need   normalized   normally   number   objects   of   on   only   options   or   order   Ortho   other   paper   Paper   parameter   passed   planes   Please   pointers   program   Program   programmer   prompts   Questions   range   ratio   receives   red   region   Reshape   reshape   resized   rock   Rock   scissors   Scissors   set   signaled   size   skewed   So   Specifically   specified   specifies   specify   specifying   square   stretched   surface   system   that   The   the   them   There   this   through   Thus   to   together   transformation   unsigned   up   upon   user   using   Viewport   wait   want   we   well   What   when   which   why   width   will   window   with   within   would   xnd   ynd   you  

    RichardLuong/Assignment01

Questions

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. In this example, we set up event handlers in main by calling glutDisplayFunc, glutReshapeFunc, and glutKeyboardFunc with the corresponding function pointers. So when a a display, reshape, or keyboard event happens, for example, the functions we specified as the arguments to glutDisplayFunc, glutReshapeFunc, and glutKeyboardFunc are signaled and executed. Thus, the programmer can get control back by specifying which events to wait on.

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

The parameter to glutInitDisplayMode() in main() specifies the initial display mode. The function receives an unsigned int. The argument is normally the bitwise OR-ing of GLUT display mode bit masks. In this example, the initial display mode is GLUT_RGBA | GLUT_DOUBLE, meaning that it is a double buffered RGBA display mode. There are other options that specify buffering and colors as well; in order to add more options you would have to OR them together.

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?

glOrtho() establishes the coordinate system the window will be using and how the final image will be mapped; the arguments to the function specify the mapping between the window and the clipping planes. However, in this example we are only using a 2D surface it only specifies the coordinate system.

glViewport()specifies the drawing region; it specifies the lower left corner and the width and height of the region. Specifically, it specifies the affine transformation of x and y from normalized device coordinates to window coordinates. Let (xnd, ynd) be normalized device coordinates.

If the window is resized, the coordinate system is altered along with the window size. Thus, objects already drawn on the canvas will become skewed and/or stretched. If we want to maintain the aspect ratio or absolute size of the objects we already drew, we will need to change the coordinate system when the window size changes through glOrtho().

Program

My program prompts the user to: "Please enter a number between 0 and 2; 0 for Rock, 1 for Paper, 2 for Scissors -- Any number not within range will default to rock: "

It draws a red circle for a rock, a green square for paper, and a blue cross for scissors upon the user input.

Recent