CS160 Program 3: Selecting and Shading
Due Tuesday, November 12, 2002 MIDNIGHT
Submit Prog3 directory using CATS Submit Program
Objectives:
Learn to use OpenGL shading, lighting, materials, and picking.
Note: this is the last official assignment and you cannot make
up late days on the project. Make every attempt to get this
in early if you now have late days.
Assignment:
-
3D Modeling:
Start with a selection of glut primitives similar to
the last assignment (a sphere, a torus, a box, a cone,
and a teapot). These should start on, or in, a shiny
white ground plane grid. The ground grid should be at least
50 by 50 polygons, all the same shiny white color.
Have 9 sliders for rotating, translating, and scaling the
active object (see below). Be able to translate, rotate, and scale the
active object freely.
-
Picking: Be able to select one of the objects but not
the floor grid by
moving the mouse over it and clicking the mouse button.
This is done using OpenGl picking. The "active" object that you
select should turn white (only the active object should be white).
-
Walk Around: Be able to alter the camera position
so that the user can "walk around" the scene and see it from
any direction. Use gluLookAt to move the eye position, which
is set by 3 translate sliders on the GUI. The LookAt position should
be the center of the scene and the up position should remain
(0,1,0).
-
Materials:
The floor grid should be a very shiny white color,
so that you can see specular highlights.
Each of your glut primitives should be a different color.
The cube should be a non-specular, diffuse red.
The torus should be a semi-transparent light blue.
The sphere should be a very specular but also diffuse
yellow.
The teapot should be a shiny green.
The others can be any color.
-
Lighting: There should be three lights:
a yellow spotlight that shines distinctly
on the shiny floor, i.e., makes a distinct yellow spot; and
a cyan positional light that is above and on one side of
the ground grid; and a white directional
light shining straight down. Also make a white ambient
light.
Make toggle buttons on the GUI to be able to
turn these each on and off. If you turn them all off,
you shouldn't see anything but black.
Each light is defined by a numeric constant (its name), and you
only need to glEnable(name) or
glDisable(name) to turn lights on
and off. The ambient light must be turned off by a
separate command.
To turn it on and off, you use
glLightModelfv( GL_LIGHT_MODEL_AMBIENT, worldAmbientOn ),
where worldAmbientOn or worldAmbientOff are the RGBA values
that the ambient should be when on or off.
Submission
-
Submission must be done using
the submit utility from CATS. Run "quickhelp submit"
or "submit -m"
on a CATS machine to get more info on the submit command.
To submit the assignment, do the following:
- Create a DIRECTORY called "
prog3". It should
contain all the files required to make your program
compile/run.
- Run "
make clean" in the directory to ensure you
do not submit .o files or the compiled program, or you
will lose points for possibly over-filling the directory.
- From prog3's parent directory (if you are in the prog3
directory, type "
cd .."), tar the directory with
the command "tar cvf prog3.tar prog3".
I strongly suggest you untar it (see above) to check.
- Compress the tar file with the command
"
gzip prog3.tar". This will produce the file
"prog3.tar.gz" which you will submit.
- Submit prog3.tar.gz with the command
"
submit cmps160-jw.f02 prog3 prog3.tar.gz".
Questions?:
E-mail
mhansen@cse.ucsc.edu and
wilhelms@cse.ucsc.edu