C481 B581 Computer Graphics
Dana Vrajitoru
Homework 7

Due date: Monday, March 21.

Preparation. Download the modified version of the cube programs. The Makefile has been updated to compile these programs with the commands "make cube" and "make cubeview". The executables it creates are "cube" and "cubeview". The cube program implements a spinning cube using a parallel projection while the cubeview program implements a static cube (spins only when you click the mouse) with a perspective projection. We would like to combine the two features in this homework.
cube1.cc
cubeview.cc
Makefile

Ex. 1
a. Modify the program cubeview.cc to add a function that continuously spins the cube (see glutIdleFunc from cube1.cc), or modify the cube1.cc to use a perspective projection.
b. Modify the program such that the point of view of the user (camera) does not change, and the keyboard actions modify a vector that is used for a glTranslatef() call to be placed just before the 3 rotations. This way, the user can move the cube with the keys instead of the camera.

Ex. 2 Replace each face of the cube with a fractal that starts with a square, divides each edge in 2, then draws a smaller square based on these points. The procedure will be repeated for a number of levels passed in as a parameter just as for the Sierpinski gasket. The function is similar to the Sierpinski one (divide triangle), only instead of a triangle you have a square and there is only one recursive call (that can be handled by a loop). The fractal can be defined either as a line strip, or as a quadrilateral, in which case you must make sure that you don't display it as a solid square in which the fractal is not visible. The management of the color is at your discretion.


Here is an example of the fractal.

Turn in: source code for both exercises (1 program) in electronic form.