CSC 240: Computer Graphics
Lab 10: Lighting in OpenGL
The goal of this lab is to understand how simple lighting models work in OpenGL
and how light sources can be animated to create lighting effects. We will also practice pair programming again!
Note: this lab will not be graded, but it will help us get ready
for the solar system homework.
and make sure you can run
You should see a "sphere" that looks something like this:
The sphere is lit by ambient lighting only.
- Comment out the ambient lighting in the code and comment in the
diffuse lighting and lighting position code. You should see a sphere
that looks like:
Comment in the ambient lighting as well to achieve both effects:
- Maybe that is too much ambient lighting. Turn down the ambient
lighting and make some modifications to achieve a red moon like this:
- Finally, change the position of the light in an animation to
make the moon look like it's waxing and waning (like phases of the