Back to index

Hierarchical Transformations

Exercises

The vertices in this program define a cube with different colors on each side. Currently, the vertices are transformed only by the view and projection matrices.
  1. Get the cube to spin by replacing the unit matrix in M with the rotation matrix Rs.
  2. Now, add the translation To, so that the cube is spinning offset from the center. The cube should not orbit!
  3. The last rotation, Ro, will make the cube orbit as well. Add it to the correct position in the chain of transformations.

Vertex shader

Vertices