More Lighting in OpenGL
Tom Kelliher, CS 320
Apr. 20, 2011
Read 8.7-8.9 (texture mapping).
Light lab.
- Walk-through code.
- Lab.
Texture mapping.
- 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.
For details, RTFM.
- Lines 228-230: Note that lighting and individual lights are enabled
separately.
Refer to source code.
Thomas P. Kelliher
2011-04-19
Tom Kelliher