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

absolute   accomplish   accumulation   alpha   alternating   and   Animation   animation   Another   anti   Anti   Art   back   be   Blue   box   buffering   buffers   call   callback   called   calls   can   canvas   certain   channel   color   Color   colors   constant   Control   control   coordinate   Decreases   depth   Display   display   does   double   Double   during   either   esc   example   Exit   files   following   for   Func   function   Function   functions   Generative   given   gl   glu   glut   Green   Gustav   helps   How   how   If   in   In   Increases   index   indexes   Init   initial   initialization   input   instead   Instructions   interaction   keeping   keyboard   Keyboard   Keys   Koch   koch   Level   Lines   main   make   map   might   mode   Mode   Motion   motion   Mouse   mouse   move   needed   Normal   of   on   or   Ortho   Other   our   painting   parameter   parameters   Parameters   passed   pointers   Points   primitives   program   Program   programmer   Red   redefine   relative   Reshape   reshape   resized   Rydstedt   scene   schema   sent   set   sets   setup   single   size   smoothing   Snowflake   specify   stencil   such   system   that   The   the   these   this   to   Together   Toggle   Toggles   transparency   triangle   two   up   use   useful   user   using   via   viewing   Viewport   walk   want   we   What   whatever   when   which   why   window   Winter   with   writes  

    GustavRydstedt/Assignment 1

Gustav Rydstedt

CS 148 - Winter 2007

"Generative Art"

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

Control is given to the user via call-back functions. Function-pointers are sent via functions such as glutDisplayFunc (for the display function).Other callback functions are glutReshapeFunc(), which is called when the window is resized, glutKeyboardFunc(), which is called in keyboard interaction, and glutMouseFunc(), called on mouse input, and glutMotionFunc(), called on mouse-motion.

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

Parameters to gluInitDisplayMode sets up the initial display mode. In our example GLUT_RGBA sets up a Red, Green and Blue color schema with and alpha channel (for transparency). Another color schema is index-mode which indexes certain colors in a color map. GLUT_DOUBLE sets the display mode to use double buffering (alternating two display buffers) instead of GLUT_SINGLE; which is single buffering. Double buffering helps in smoothing animation. Other parameters can setup the window to use accumulation, depth, or stencil buffers.

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?

glViewport sets up the "viewing box"; that is, sets up the painting canvas for the program. Together with glOrtho (which can redefine and move the coordinate system) these two functions set up the relative coordinate system. In the reshape function these are useful in either keeping the scene relative to the size of the window; or make primitives have constant (or absolute) size whatever the window-size.

Program Instructions

The program writes a koch-triangle (and anti-koch) using GL_LINES and GL_POINTS.

The following files are needed: main.cpp, koch.h and walk.h.

Keys:

  • (+) Increases Koch-Level

  • (-) Decreases Koch-Level

  • (a) Toggles Animation

  • (t) Toggle Normal/Anti Snowflake

  • (c) Toggle Color

  • (p) Toggle Lines/Points

  • (esc) Exit

Recent