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

accomplish   actual   allows   alter   an   and   area   aspect   Assignment   back   be   because   black   blue   buffering   buffers   By   call   callback   called   calls   can   changes   clipping   color   coloring   combined   common   Control   control   dimensions   Display   display   displayed   does   double   draw   drawn   draws   during   During   event   example   filled   fixed   For   for   from   Func   function   functions   given   gl   glu   glut   goes   green   How   how   if   If   in   In   Init   initialization   instead   iterations   just   key   keyboard   Keyboard   keys   Koch   line   logical   loop   main   many   means   middle   might   Mode   modified   most   My   my   occur   of   on   options   or   Ortho   Ortho2   our   outline   parameter   passed   pointers   pressed   Pressing   pressing   program   programmer   properties   ratio   rectangular   red   reshape   resized   respectively   running   screen   set   sets   should   size   snowflake   space   specifications   specifies   specify   stretched   such   that   The   the   then   these   this   Thus   to   triangles   two   type   up   use   used   using   values   ve   viewport   Viewport   want   we   What   what   when   where   whether   which   while   why   will   window   you  

    AmandaLuther/Assignment1

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 to the programmer using callback functions. During initialization, the programmer specifies what these callback functions are using function pointers. For example, the call to glutKeyboardFunc(keyboard) during initialization sets up the "keyboard" function as the callback for a keyboard event. Thus, if a key is pressed while the program is running, the keyboard function will be called, which allows the programmer to specify in this function what should occur when a given key is used.

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

The parameter to glutInitDisplayMode() specifies the display properties for the window. The most common window properties to specify are the type of color to use and whether or not to use double buffering. The values for the parameter are combined using the logical OR of options such as color type and buffering specifications. In my program, the parameter "GLUT_RGBA | GLUT_DOUBLE" specifies RGBA coloring and double buffering of color buffers.

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 call to glOrtho specifies a clipping window that goes from (0, 0) to (1, 1) in two dimensions. A viewport is rectangular area of the window on the screen, which specifies where in the actual window on screen we draw. If the window is to be resized, we might want to change this because it means that our drawing can be stretched when the window is. If instead we call gluOrtho2D(-w/size, w/size, -h/size, h/size), as I've modified the code, then the aspect ratio and size of the drawing will be fixed when the window is resized.

My program

My program draws Koch's snowflake in the middle of the window. By pressing the keys 0-9, you can alter how many iterations the snowflake has. Pressing the r, g, b, and k keys changes the color to red, green, blue, and black, respectively. Pressing the space key changes whether just an outline of the snowflake is drawn (using a line loop) or whether a filled snowflake is displayed (using triangles).

Recent