CMP 160 -- Programming Assignment 4
Due date:
10:00am THUR, 11/4/99
Objectives:
Learn hidden surface elimination using z-buffer algorithm.
Learn flat and smooth shading of different object materials.
Learn lighting.
To Do:
-
First thing you want to do is to "flesh out" the wireframes
from program 3. You can do this using the zbuffer implementation
in OpenGL.
-
Next, you will want to specify different colors for your object(s).
Either one color for an entire object (minimum),
or different colors for different parts of an object.
In addition, allow the user to toggle from wireframe,
to flat or constant (one color per polygon),
to smooth (using Gouraud shading).
-
Finally, you will want to specify lighting in your world.
Your program should have at least one light source.
Allow the user to change lighting parameters (e.g. color).
As a minimum, use point light sources.
-
As in program 3, allow the objects
(including the light source(s)) in the scene
to be manipulated.
For light sources,
you can restrict transformations to translations
(if point source)
and also rotation (if directional lighting).
-
Like your earlier programs, it's always nice to have
things behave properly even after your "window" has
been moved and/or resized.
Notes:
-
Use the data files in the class directory:
/afs/cats.ucsc.edu/class/cmps160.f99/data.
If you are using other data sets,
be sure to include them with your submission.
-
You will need a polygon normal for flat shading
and a vertex normal for smooth shading.
Be sure to pick this up from class if it's
not obvious to you.
-
Some useful OpenGL functions:
glShadeModel, glNormal,
glDepthFunc(GL_LESS),
glEnable(GL_CULL_FACE), glEnable(GL_LIGHTING), glEnable(GL_DEPTH_TEST),
glLight, glMaterial.
-
Some useful online examples (/afs/cats.ucsc.edu/class/cmps160.f99/openglbk)
movelight.c and light.c
-
Bits and pieces of code that may or may not be useful:
snippets.c
-
If small or thin objects are disappearing,
you may want to adjust your near/far planes.
-
Submission must be done using the submit or xsubmit utility from CATS.
Run "quickhelp submit" on a CATS machine to find out more info.
Create and submit a subdirectory called "prog4". It should
contain all the files you have in make your program compile/run.
This includes folks using Windows/NT/MAC environments.
-
Grading guide
Last modified
Friday, 22-Oct-1999 20:59:05 PDT.