CS 381, Fall 2007
HW #5

General Information

Homework Policies

See the Homework Policies handout.

Questions (5 pts)

  1. Exercise 5.8.
  2. Exercise 5.12.

Program #1 (5 pts)

Start with the trackball color cube program cubet.c from Chapter 4 of the text. Remove the spinning rotation animation and program the mouse to provide an interface which allows the cube to be rotated, translated and scaled, by dragging the left, middle, and right buttons, respectively. Also, add a keyboard callback and use the 'R' to reset the model_view matrix and 'Q' to quit the program.

Program #2 (5 pts)

Exercise 5.19. Start with the 3D sierpinski gasket program gasket3.c from Chapter 2 of the text. Follow a linear trajectory that passes through the gasket and is parallel to the z axis. Choose the increment along the camera path so that the fly-through takes about 5 seconds with smooth motion.

Extra Credit:

Program #3 (5 pts)

Exercise 5.21. Divide your display vertically down the center and create separate GLUT windows for the left and right halves of the screen. Display the same color cube in each window using slightly different camera positions corresponding to the spacing between your left and right eyes when viewing the cube from a distance of 11 inches. Place the edge of a manilla folder or a piece of stiff construction paper vertically against your forehead centered between your eyes so that your left eye only sees the left half of the screen and your right eye only sees the right half of the screen. The distance from your eyes to the screen should be 11 inches. By looking "through" the screen to a point several feet behind the screen, you should be able to fuse the left and right views of the cube into a single cube which appears 3D. Experiment with the camera positions to produce the best effect and report your results. The cube_view.c program from Chapter 5 provides a good starting point for positioning the camera.

Extra Credit:

Note

Particularly well-done programs may be demonstrated in class.


CS 381, Fall 2007: Assignment 5 / Last update: 21 Oct 2007