CS155 Computer Graphics

Snowman Lab - Redux

In this lab you'll recreate your snowman scene graph in openGL. This snowman, however, will have arms and be interactive.

The basic building blocks you'll use is a glutSolidBox (arms) and glutSolidSphere (for everything but arms).

  1. Set up an initial world with the camera at (0,1,5) looking at the origin with up in the (0,1,0) direction. We'll use colors rather than lighting (the scene will seem flat but that is ok).
  2. Create a red floor that is 5x5, centered at the origin, using a GL_QUAD.
  3. Create a draw method for each node in the scene graph below. Within the draw method you should push the current model view matrix to the matrix stack, apply the transforms to convert local coordinates to parents coordinates, call the draw functions for each child or draw the appropriate primitive, and finally pop the matrix stack.

  4. Introduce the following global variables (doubles) snowmanX, snowmanY, and headTheta. They should be initialized to 0.
  5. When the user presses the x key key, snowmanX should decrement by 1. Pressing X should increment the variable by 1. Use y and Y to to change snowmanY and q and Q to control headTheta.
  6. Introduce appropriate transforms within the scene graph to position the snowman at snowmanX, snowmanY and to shake the snowman's head (i.e. rotate by headTheta) .


Last updated March 2013