CS 5600 - Spring 2008

Homework Assignment 7

OpenGL Lighting and Texturing (100 points)

Handed out: April 7, 2009

Due: midnight, April 14, 2009

You will write an OpenGL program which texture maps a cylinder.  Please generate the geometry and texture coordinates like we described in class.  Take care that the normals provide for smooth shading.  The cylinder should have 10 facets on the sides and caps on the end.  Like this looking from the top but make yours even, this was just a rough sketch:

1. The camera controls are like last time (circling the scene with a speed control).

2. The light control will be like last time (switch between following the viewer and stationary light).

3. The light should be a white light at full intensity. 

4. You should texture map the cylinder by combining the texture map of the coke-can with an image of your face.  Please an image of your face in the lower left corner of this texture map where the gray square is located. Use your digital camera or phone to get the photo and gimp or photoshop to convert it into a suitable format and place it into the provided texture.  You should then texture map the cylinder by wrapping the it with the texture map you created.  It should look like a can of Coke as in this example-image.

5. After typing the 'q' key, the lighting should be flat-shading.

6. After typing the 'w' key, the lighting should be smooth shading.

7. Switch between texture modes: ‘m’ modulate mode, ‘r’ replace mode

8. You should draw the result into a 512x512 window.

9. You must turn in documentation in the form of a webpage as in the other assignments.

10. You must use perspective projection for this assignment (like the last assignment).

11. To read/write ppm files, use the glm.h and the glm.cpp header/code (thanks to Nate Robins again!).  Here’s an example.

Output

The program should draw its output to an OpenGL window of size 512x512 as in the example program.

Submission

use the handin routine in the CADE Lab. You can with zip or tar your solution. You should comment your code appropriately and hand in a web-page that will serve as complete documentation. Please include a paragraph of difficulties and a paragraph of what you learned in this assignment.

The handin name for this lab is "lab7".

Windows users should use the Zip utility and handin a single zipped file. Unix users should use the tar program to do the same. We will recompile the programs to grade them. Make sure your workspace/program will compile for us. That is, be careful about your user-specific pathname variables! If you do this on a home machine, please allow sufficient time for porting to the CADE machines. We will grade based on compiling and running on the CADE machines.

Due to a bug in the handin program, do not include spaces in the names of the files that you submit, otherwise we will not receive them. For instance, "no spaces.txt" is not a valid filename and would not be received, while "no_spaces.txt" is valid. Please keep this in mind while handing in your assignment.