C M S I 3 7 1
CO M P U T E R GR A P H I C S
Fall 2005
Assignment 0920
Your initial taste of OpenGL programming has been primarily for display, with very nominal interac-
tion. For this assignment, we are increasing the interaction quotient and adding more display tricks.
Not for Submission
1. Read Chapter 3 in Angel. Scan through the exercises at the end of Chapter 3 — almost all of
them relate to programming specific functions in OpenGL — and try to do anything that is of
particular interest to you or that might be relevant to your graphics project.
2. Reminder: your project prospectus is due one week after this assignment.
For Submission
Please submit all assignments on hardcopy; this is what I will count as proof-of-assignment. In addition,
e-mail the source code of programming assignments to me. Again, the ground rule is: everything on
hardcopy, and source code via e-mail also.
Expand the “spinning anything” program that you have developed by adding the following interaction
and display features. Note how the sample code that I’ve given out (as well as Angel Chapter 3) pretty
much tells you how to do (2) and (4); it’s (3) that’s somewhat new, but with a single function — glu-
LookAt() — to tweak, it shouldn’t be too hard. You may re-organize your program’s controls so that the
new features co-exist smoothly with the existing spin toggle and shape-switching controls:
1. 3D shapes — If you haven’t already done so, change at least two of your shape selections to
fully 3D objects, since they will best show off what you’re adding in (2), (3), and (4).
2. Mouse rotation — Implement a “virtual rotator” that allows the user to rotate the viewed shape
in 3D using the mouse. The rotation should feel natural (e.g. correspondent to how the user
moves the mouse) as if the user were turning an object around in his or her hand.
3. Camera control — Implement controls that allow the user to “move” the camera — position, eye
point, and, if you like, the up vector. Hint 1: There is a sample program in Angel Appendix A
that can get you started with this. Hint 2: Many 3D shoot-‘em-ups have standardized on a par-
ticular combination of keyboard shortcuts for this; feel free to use the same keys for your own
program.
4. Lighting — Set up at least one light in your program, and set various material properties for your
objects so that they have a true, full-blown 3D feel.