Chair of Computer Graphics and Visualization

Sheet 4: Interpolation & Transformation

Exercise: Colored Triangles (10 points)

The provided code for this exercise already contains parts from the previous task: GLFW and GLEW initialization are encapsulated in classes inside the Utils folder. That folder also contains matrix and vector classes, which will be used in this and upcoming exercises.

You do not need to modify the code in Utils. For this assignment, it is sufficient to edit only the classes in the Hello_Triangles directory. Your shader source files are located in the res subfolder. The GLHelper files assist in compiling these shaders.

The example program main.cpp renders a simple white triangle (see the left image in Figure triangles). Extend the program so that it matches exactly the right image: Three equilateral triangles with color-interpolated corners (red, magenta, yellow, blue, cyan, green).

Use the vector and matrix classes in the Utils folder, as transformations will be essential for the following tasks.

Exercise: Transformations & Animations (10 points)

Extend your solution from the Colored Triangles task so that each of the three equilateral triangles rotates at 45 degrees per second — each around one of the primary axes:

Continue to use an orthographic projection as in the previous exercise. You can refer to the example below for visual verification.

Additionally, the program must support the following user input:

When the application starts, the animation must be paused in the reset state.

White Triangle
Loading

Top – initial state. Bottom – color-interpolated Triforce.
Press Spacebar to toggle the animation. Press R to reset the animation.