CompSci 344
Spring 2015
Computer Graphics

Lab: Accumulating OpenGL Transforms

The goal of this lab is to understand how to transform objects using OpenGL. Starting with this code, you will create an animated scene in which transformations are accumulated on objects to achieve a desired effect.

Making a Robotic Arm

  1. Create a cube, aligned along the x-axis, that the user can rotate about its left end (not the center) around the z-axis using the keyboard (i.e., one key rotates it clockwise and another counter-clockwise). Also allow the user to reset the cube back to its original configuration by pressing a third key.
  2. Create another cube, also aligned along the x-axis but shorter than the first one, and next to the original cube on its right end (i.e., so that both cubes are tangent to each other in a line along the x-axis). When the user rotates the original cube, this new cube should rotate as well, staying perfectly aligned with the original one so that they seem to rotate as a single object. The reset key should be modified to work with both cubes as well.
  3. Add another pair of keys that the user can press that rotates only the second cube clockwise or counter-clockwise about the z-axis. Thus, the user should now be able to rotate both cubes as a single object, regardless of their relative orientation, or rotate just the new cube about the joint it creates with the original cube.

  4. Add another cube to the group, that operates as the second one does (with the group or on its own).

This approach is what you should use for applications such as articulated robot arms, where there are joints at the shoulder, elbow, and wrist, and on each of the fingers. To figure out where the tips of the fingers go relative to the body, you'd like to start at the shoulder, go down to the wrist, and so on, applying the appropriate rotations and translations at each joint.