NAME
glLightModelf, glLightModeli, glLightModelfv, glLightModeliv
- set the lighting model parameters
C SPECIFICATION
void ggllLLiigghhttMMooddeellff(
GLenum _p_n_a_m_e,
GLfloat _p_a_r_a_m )
void ggllLLiigghhttMMooddeellii(
GLenum _p_n_a_m_e,
GLint _p_a_r_a_m )
delim $$
PARAMETERS
-
_p_n_a_m_e
-
Specifies a single-valued lighting model parameter.
GGLL__LLIIGGHHTT__MMOODDEELL__LLOOCCAALL__VVIIEEWWEERR,
GGLL__LLIIGGHHTT__MMOODDEELL__CCOOLLOORR__CCOONNTTRROOLL, and
GGLL__LLIIGGHHTT__MMOODDEELL__TTWWOO__SSIIDDEE are accepted.
-
_p_a_r_a_m
-
Specifies the value that _p_a_r_a_m will be set to.
C SPECIFICATION
void ggllLLiigghhttMMooddeellffvv(
GLenum _p_n_a_m_e,
const GLfloat _*_p_a_r_a_m_s )
void ggllLLiigghhttMMooddeelliivv(
GLenum _p_n_a_m_e,
const GLint _*_p_a_r_a_m_s )
PARAMETERS
-
_p_n_a_m_e
-
Specifies a lighting model parameter.
GGLL__LLIIGGHHTT__MMOODDEELL__AAMMBBIIEENNTT,
GGLL__LLIIGGHHTT__MMOODDEELL__CCOOLLOORR__CCOONNTTRROOLL,
GGLL__LLIIGGHHTT__MMOODDEELL__LLOOCCAALL__VVIIEEWWEERR, and
GGLL__LLIIGGHHTT__MMOODDEELL__TTWWOO__SSIIDDEE are accepted.
-
_p_a_r_a_m_s
-
Specifies a pointer to the value or values that _p_a_r_a_m_s will be set to.
DESCRIPTION
ggllLLiigghhttMMooddeell sets the lighting model parameter.
_p_n_a_m_e names a parameter and _p_a_r_a_m_s gives the new value.
There are three lighting model parameters:
-
GGLL__LLIIGGHHTT__MMOODDEELL__AAMMBBIIEENNTT
-
_p_a_r_a_m_s contains four integer or floating-point values that specify
the ambient RGBA intensity of the entire scene.
Integer values are mapped linearly such that the most positive representable
value maps to 1.0,
and the most negative representable value maps to -1.0.
Floating-point values are mapped directly.
Neither integer nor floating-point values are clamped.
The initial ambient scene intensity is (0.2, 0.2, 0.2, 1.0).
-
GGLL__LLIIGGHHTT__MMOODDEELL__CCOOLLOORR__CCOONNTTRROOLL
-
_p_a_r_a_m_s must be either GGLL__SSEEPPAARRAATTEE__SSPPEECCUULLAARR__CCOOLLOORR or
GGLL__SSIINNGGLLEE__CCOOLLOORR.
GGLL__SSIINNGGLLEE__CCOOLLOORR specifies that a single color is generated from the
lighting computation for a vertex. GGLL__SSEEPPAARRAATTEE__SSPPEECCUULLAARR__CCOOLLOORR
specifies that the specular color computation of lighting be stored
separately from the remainder of the lighting computation. The specular
color is summed into the generated fragment's color after the application
of texture mapping (if enabled). The initial value is GGLL__SSIINNGGLLEE__CCOOLLOORR.
-
GGLL__LLIIGGHHTT__MMOODDEELL__LLOOCCAALL__VVIIEEWWEERR
-
_p_a_r_a_m_s is a single integer or floating-point value that specifies
how specular reflection angles are computed.
If _p_a_r_a_m_s is 0 (or 0.0), specular reflection angles take the
view direction to be parallel to and in the direction of the -_z axis,
regardless of the location of the vertex in eye coordinates.
Otherwise, specular reflections are computed from the origin
of the eye coordinate system.
The initial value is 0.
-
GGLL__LLIIGGHHTT__MMOODDEELL__TTWWOO__SSIIDDEE
-
_p_a_r_a_m_s is a single integer 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,
lines,
or bitmaps.
If _p_a_r_a_m_s is 0 (or 0.0), one-sided lighting is specified,
and only the _f_r_o_n_t material parameters are used in the
lighting equation.
Otherwise, two-sided lighting is specified.
In this case, vertices of back-facing polygons are lighted using the
_b_a_c_k material parameters,
and have their normals reversed before the lighting equation is evaluated.
Vertices of front-facing polygons are always lighted using the
_f_r_o_n_t material parameters,
with no change to their normals. The initial value is 0.
In RGBA mode, 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.
In color index mode,
the value of the lighted index of a vertex ranges from the ambient
to the specular values passed to ggllMMaatteerriiaall using GGLL__CCOOLLOORR__IINNDDEEXXEESS.
Diffuse and specular coefficients,
computed with a (.30, .59, .11) weighting of the lights' colors,
the shininess of the material,
and the same reflection and attenuation equations as in the RGBA case,
determine how much above ambient the resulting index is.
NOTES
GGLL__LLIIGGHHTT__MMOODDEELL__CCOOLLOORR__CCOONNTTRROOLL is available only if the GL version is
1.2 or greater.
ERRORS
GGLL__IINNVVAALLIIDD__EENNUUMM is generated if _p_n_a_m_e is not an accepted value.
GGLL__IINNVVAALLIIDD__EENNUUMM is generated if _p_n_a_m_e is
GGLL__LLIIGGHHTT__MMOODDEELL__CCOOLLOORR__CCOONNTTRROOLL and _p_a_r_a_m_s is not one of
GGLL__SSIINNGGLLEE__CCOOLLOORR or GGLL__SSEEPPAARRAATTEE__SSPPEECCUULLAARR__CCOOLLOORR.
GGLL__IINNVVAALLIIDD__OOPPEERRAATTIIOONN is generated if ggllLLiigghhttMMooddeell is executed between
the execution of ggllBBeeggiinn and the corresponding execution of ggllEEnndd.
ASSOCIATED GETS
ggllGGeett with argument GGLL__LLIIGGHHTT__MMOODDEELL__AAMMBBIIEENNTT
ggllGGeett with argument GGLL__LLIIGGHHTT__MMOODDEELL__CCOOLLOORR__CCOONNTTRROOLL
ggllGGeett with argument GGLL__LLIIGGHHTT__MMOODDEELL__LLOOCCAALL__VVIIEEWWEERR
ggllGGeett with argument GGLL__LLIIGGHHTT__MMOODDEELL__TTWWOO__SSIIDDEE
ggllIIssEEnnaabblleedd with argument GGLL__LLIIGGHHTTIINNGG
SEE ALSO
ggllLLiigghhtt((33GG)),
ggllMMaatteerriiaall((33GG))