More Lighting in OpenGL
Tom Kelliher, CS 320
Apr. 20, 2005
Collect exams.
For Monday: Read 7.1--7.6 (texturing mapping).
Light lab.
- Walk-through code.
- Lab.
Exam.
- Lines 13--24: The experiments.
- Lines 76--78: Disable all lighting to render the sphere representing
the moving light as a 2-D object.
- Lines 143--144: Disable and enable the fixed spotlight.
- Lines 210--216: Specifying
GL_LIGHT1
's position here, before
the call to gluLookAt()
results in the light being positioned in eye
coordinates.
- Line 227:
glLightModel*(pname, param)
:
- This call correctly computes specular reflections by correctly
determining the viewer angle. Otherwise, the viewer is assumed to be at
infinity and the view angle will be along the -z axis.
- Other
pname
s:
-
GL_LIGHT_MODEL_AMBIENT
: Set global ambient parameters.
-
GL_LIGHT_MODEL_TWO_SIDE
: Set to !0 to enable two-sided
lighting using back material parameters.
Translucence?
For details, RTFM.
- Lines 228--230: Note that lighting and individual lights are enabled
separately.
Refer to source code.
Thomas P. Kelliher
Tue Apr 19 17:22:11 EDT 2005
Tom Kelliher