CS 381 Fall 2012
Assignment 5
Assignment 5 is due at 5 p.m. Monday, October 29.
It is worth 20 points.
Procedures
E-mail
answers to the exercises below to
ggchappell@alaska.edu,
using the subject
“GA5”.
- Your answers should consist of the source code for the
application and shaders for Exercise A.
These should be attached to your e-mail message.
- Send only the above!
I do not want project files or executables.
I also do not want things I already have, like
glut.h.
- Be sure to include your name in your e-mail.
- I may not read your homework e-mail immediately.
If you wish to discuss the assignment (or anything else)
with me, send me a separate message with a different subject line.
Working in Pairs
This assignment may optionally be done in pairs.
If you work with someone else:
- Put both names in the submission e-mail and in the source code files.
- Cc: the submission e-mail to the other student,
so that I can send an acknowledgement to both.
- Under normal circumstances, both authors will receive the same grade.
Exercises (20 pts total)
Exercise A — 3-D with Shaders, Facet Normals, Lighting
Purpose
In this exercise, you will write an OpenGL/GLUT application
and associated shaders in GLSL.
Your program will do lighting and compute facet normals.
Instructions
Write an OpenGL program and associated GLSL shaders that meet the following requirements.
- You must include at least one vertex shader and one fragment shader.
- At least one of your shaders must do lighting computations.
- Your application must compute at least one facet normal
from vertex coordinates, and make use of it in an appropriate way
(for lighting, probably).
- Hint: a good idea is to write a function that is given three vertices
and draws a triangle with the appropriate normal,
then use this function repeatedly in your display callback.
- Other requirements are as for previous 3-D assignments
(C or C++, OpenGL/GLUT, rules for callbacks,
interactive animation, double buffering, 3-D, HSR,
perspective, using model/view, original content).
Notes
- “Lighting” means something
at least at the level of the Lambertian model.
- Standards for code are as for
the first assignment
(must compile, readable, following conventions,
avoid extra output,
clear how program is used, not buggy-looking, give credit, etc.).
- Some of you wrote some very nice programs for Assignment 4,
and some of those programs could have used lighting.
Here is your chance.
- Submitted code may be demonstrated in class.