glLightModel — set the lighting model parameters
void glLightModelf( | GLenum pname, |
GLfloat param) ; |
void glLightModelx( | GLenum pname, |
GLfixed param) ; |
pname
Specifies a single-valued lighting model parameter. Must be
GL_LIGHT_MODEL_TWO_SIDE
.
param
Specifies the value that param
will be set to.
void glLightModelfv( | GLenum pname, |
const GLfloat * params) ; |
void glLightModelxv( | GLenum pname, |
const GLfixed * params) ; |
pname
Specifies a lighting model parameter.
GL_LIGHT_MODEL_AMBIENT
and
GL_LIGHT_MODEL_TWO_SIDE
are accepted.
params
Specifies a pointer to the value or values that
params
will be set to.
glLightModel
sets the lighting model parameter.
pname
names a parameter and
params
gives the new value. There are two lighting model parameters:
GL_LIGHT_MODEL_AMBIENT
params
contains four fixed-point or floating-point values that
specify the ambient intensity of the entire scene.
The values are not clamped. The initial value is
(0.2, 0.2, 0.2, 1.0).
GL_LIGHT_MODEL_TWO_SIDE
params
is a single fixed-point or floating-point value that
specifies whether one- or two-sided lighting calculations
are done for polygons. It has no effect on the lighting
calculations for points or lines. If
params
is 0, one-sided lighting is specified, and both front- and
back-facing polygons are assigned the same computed color.
Otherwise, two-sided lighting is specified. In this case,
vertices of back-facing polygons have their normals reversed
before the lighting equation is evaluated. Vertices of
front-facing polygons are always lighted with no change to
their normals. The initial value is 0. Note that there is
only one set of material properties shared by both
front- and back-facing polygons.
The lighted color of a vertex is the sum of the material emission intensity, the product of the material ambient reflectance and the lighting model full-scene ambient intensity, and the contribution of each enabled light source. Each light source contributes the sum of three terms: ambient, diffuse, and specular. The ambient light source contribution is the product of the material ambient reflectance and the light's ambient intensity. The diffuse light source contribution is the product of the material diffuse reflectance, the light's diffuse intensity, and the dot product of the vertex's normal with the normalized vector from the vertex to the light source. The specular light source contribution is the product of the material specular reflectance, the light's specular intensity, and the dot product of the normalized vertex-to-eye and vertex-to-light vectors, raised to the power of the shininess of the material. All three light source contributions are attenuated equally based on the distance from the vertex to the light source and on light source direction, spread exponent, and spread cutoff angle. All dot products are replaced with 0 if they evaluate to a negative value.
The alpha component of the resulting lighted color is set to the alpha value of the material diffuse reflectance.
Copyright © 2003-2004 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.