More Lighting in OpenGL

Tom Kelliher, CS 320

Apr. 23, 2003

Administrivia

Announcements

Collect exams.

Assignment

Read Read 7.1--7.6.

Final project.

From Last Time

Exam.

Outline

  1. Walk-through code.

  2. Lab.

Coming Up

Texture mapping.

Code Walk-Through

  1. Lines 13--24: The experiments.

  2. Lines 76--78: Disable all lighting to render the sphere representing the moving light as a 2-D object.

  3. Lines 143--144: Disable and enable the fixed spotlight.

  4. Lines 210--216: Specifying GL_LIGHT1's position here, before the call to gluLookAt() results in the light being positioned in eye coordinates.

  5. Line 227: glLightModel*(pname, param):
    1. 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.

    2. Other pnames:
      1. GL_LIGHT_MODEL_AMBIENT: Set global ambient parameters.

      2. GL_LIGHT_MODEL_TWO_SIDE: Set to !0 to enable two-sided lighting using back material parameters.

        Translucence?

    For details, RTFM.

  6. Lines 228--230: Note that lighting and individual lights are enabled separately.

Lab

Refer to source code.



Thomas P. Kelliher
Wed Apr 23 08:33:14 EDT 2003
Tom Kelliher