BU
CAS
CS 480
Introduction to Computer Graphics
Spring 1996
Programming Assignment 5:
Shading, Lighting, and Camera Modeling
Due before class on Tuesday April 22
Write an OpenGL program that implements at least the following capabilities:
- shaded (Z-buffered) display of multiple polygonal objects
- perspective viewing, with user-controlled camera parameters:
field of view angle, 3-D camera position and orientation
- object selection via a mouse click in window
- change material for the selected object via pull down menu
- support for up to 5 colored light sources
- allow the user to turn lights on/off and change lights' colors
For extra credit, implement as many of the following as you like
(ten points extra credit each):
- stereo viewing with the crystal eyes
- shadows
- depth of focus
- environment mapping
Hints
There are a number of useful example programs provided in the red book and
in the GLUT directories on the CGL cluster. Some of these are listed below.
Word of Caution: It may be tempting to copy one of
these example programs and then modify it to add required
functionality. Taking such an approach will make your life needlessly
difficult, because it requires retrofitting someone else's code. A
better approach is to write your own code from scratch. Develop your
own program specification, write your own code, and only use the
example programs as reference when you need to see how something is
done.
Here are some example programs that may serve as good reference:
- The GLUT provides triangle generators for a few polygonal shapes.
Look at "glut_teapot.c" and "glut_shapes.c"
- The red book provides many example programs that demonstrate material
properties and colored lights. Source for these is available in the
directory "/usr2/cs480/courseware/glut-3.0/progs/redbook". In
addition, there is a GLUT light lab progam in
"/usr2/cs480/courseware/glut-3.0/progs/examples/lightlab.c".
- There are examples of selection mode provided in
"/usr2/cs480/courseware/glut-3.0/progs/redbook/pickdepth.c", and in
"/usr2/cs480/courseware/glut-3.0/progs/examples/highlight.c".
- There is an implementation of depth of focus provided in
"/usr2/cs480/courseware/glut-3.0/progs/redbook/dof.c".
- An example GLUT stereo viewing program is provided in
"/usr2/cs480/courseware/glut-3.0/progs/sgi-stereo".
- There are example implementations of shadows provided in
"/usr2/cs480/courseware/glut-3.0/progs/examples/scube.c"
and "/usr2/cs480/courseware/glut-3.0/progs/contrib/moth.c".
Demos and Grading
Your project must run on the SGI, therefore you will need
to use one of the SGI workstations in the CGL cluster (unless you have
access to an OpenGL elsewhere).
Your program's source files are to be electronically submitted by using the submit program on cgl. The code you submit
should conform with the program assignment
guidelines.
Part of your grade for this programming assignment will be based on
your giving a short demo (2-3 minutes) in the CGL cluster. You will
be expected to talk about how your program works, and we will see
how well your program performs on some test examples. Demos will be
scheduled from 2-5 on the assignment due date.
Page Created: April 7, 1997
Last Modified: April 7, 1997
Maintained by: Stan Sclaroff