Specifying the Lighting Model

GLvoid glLightModelfv(GLenum pname, const GLfloat *params)
  • pname indicates which property to change

  • params is a Boolean value or array of RGBA values

pname Default Value Description
GL_LIGHT_MODEL_AMBIENT (0.2, 0.2, 0.2, 1.0) Specifies global ambient illumination; not from any particular light source
GL_LIGHT_MODEL_LOCAL_VIEWER 0.0 (infinite) Specifies whether viewer is local to the scene or an infinite distance away
GL_LIGHT_MODEL_TWO_SIDE 0.0 (one-sided) Specifies whether to perform lighting calculations for both the front and back surfaces


Notes:

GL_LIGHT_MODEL_AMBIENT specifies the ambient light color when no lights are on. It represents light that is not from any particular source. The default value {0.2, 0.2, 0.2, 1.0} yields a small amount of white ambient light. So, even if you do not add a specific light source to your scene, you can still see the objects in the scene.

GL_LIGHT_MODEL_LOCAL_VIEWER changes the assumptions made about the location of the viewpoint. (It does not actually move the viewpoint).