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

actually   allow   and   Answer   Answers   around   artifacts   aspect   at   axes   axis   back   based   be   been   behaviour   blue   bottom   buffer   buffering   by   calculated   call   called   calls   can   canvas   certain   changed   Colour   colours   common   completely   components   consistent   constants   contains   Control   coordinate   cube   currently   define   defines   depending   desired   direction   disjunction   Display   display   done   double   Double   draw   drawn   draws   During   each   etc   events   example   except   faces   figure   fired   For   for   format   frame   from   fulfill   Func   function   functions   gl   glut   going   green   height   how   if   If   image   images   in   Init   initialisation   into   its   keep   Keyboard   keystrokes   left   like   line   lines   loaded   made   mapping   memory   method   middle   might   Mode   modified   move   much   name   need   needed   needs   negative   new   next   of   on   only   opposite   or   original   Ortho   other   our   out   parameter   parameters   passed   place   plane   planes   point   pointing   positive   pressing   prevents   primitives   program   programmer   questions   ratio   red   render   replaced   Reshape   resize   resized   rotate   rotation   rotations   says   scale   screen   select   shapes   Single   size   so   something   specified   stay   system   takes   tearing   technique   tell   tells   tenth   terms   that   The   the   then   Then   thing   This   this   through   to   To   two   type   use   used   user   using   values   various   very   Viewport   want   wants   way   we   were   what   whatever   when   whether   which   while   whole   width   will   window   with   would   You  

    KyanpAssign1

This program draws a cube except two opposite faces have been replaced by 2 lines to fulfill the whole 2 primitives thing.

To move the figure around in the XY plane, use WASD. I have not changed the glOrtho and glViewport to keep this consistent after rotations, so this will move the figure in whatever direction the original X and Y axes are currently pointing. You can select a rotation axis by pressing 1, 2 or 3 (For X, Y and Z). Then rotate the figure in the desired direction using '[' and ']'.

Answers to questions:

Answer 1:

Control is passed back to the programmer using a method that is called when the program needs to draw something to the window. This 'display' function contains the code to actually draw out the various shapes etc needed. During initialisation, we need to tell GLUT what method we use as our display function. This is done through a call to glutDisplayFunc(); which takes in the name of the desired display function as its only parameter.

Also, other functions like glutReshapeFunc(); and glutKeyboardFunc(); allow the programmer to define the behaviour of the program when events like keystrokes or a window resize are fired.

Answer 2:

The parameter to glutInitDisplayMode() is a disjunction of certain constants that tell GLUT whether:

- Single or double buffer will be used. Double buffering is a very common technique that is used to render the next frame completely in memory and then only display it to the screen when it is completely loaded. This prevents tearing of images and artifacts, and

- Colour format. This tells GLUT what type of colours will be used. For example, GL_RGB says that colours will be specified in terms of red, green and blue components.

Answer 3:

glOrtho(): The parameters to this function define the coordinate system for each of the 3 planes. For example, if the first two parameters to glOrtho are 0.0 and 1.0 and we draw something at 0.5 on the x-axis, it will be drawn in the middle of the window. If the two parameters were 0.0 and 5.0, it would be drawn a tenth of the width from the left of the window on the x-axis.

For the Z-plane, the line pointing out at the user is the positive axis while the line going into the screen is negative.

glViewport(): This defines how much of the window the programmer wants to use to draw. It takes 4 parameters - x and y of the bottom left point of the drawing 'canvas' and the width and height of the canvas.

If the window is resized, we might want to change the values in glOrtho() and glViewport depending on whether we want the image drawn to scale, to stay in its place, keep its size or be modified in any way. A new aspect ratio can be calculated based on what the programmer wants and the new mapping can be made with calls to glViewport() and glOrtho();

Recent