- set the lighting model parameters



C SPECIFICATION


PARAMETERS

       _param1  Specifies  a single-valued lighting model parame-
                ter.                 GL_LIGHT_MODEL_LOCAL_VIEWER,
                GL_LIGHT_MODEL_COLOR_CONTROL,                 and
                GL_LIGHT_MODEL_TWO_SIDE are accepted.

       _param2  Specifies the value that _param2 will be set  to.


C SPECIFICATION


PARAMETERS

       _param1
              Specifies     a     lighting    model    parameter.
              GL_LIGHT_MODEL_AMBIENT,
              GL_LIGHT_MODEL_COLOR_CONTROL,
              GL_LIGHT_MODEL_LOCAL_VIEWER,                    and
              GL_LIGHT_MODEL_TWO_SIDE are accepted.

       _param2
              Specifies  a  pointer  to  the value or values that
              _param2 will be set to.


DESCRIPTION

       glLightModel sets the lighting model  parameter.   _param1
       names  a parameter and _param2 gives the new value.  There
       are three lighting model parameters:

       GL_LIGHT_MODEL_AMBIENT
                 _param2 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 repre-
                 sentable value maps to 1.0, and the  most  nega-
                 tive  representable  value maps to -1.0.  Float-
                 ing-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).

       GL_LIGHT_MODEL_COLOR_CONTROL
                 _param2          must          be         either
                 GL_SEPARATE_SPECULAR_COLOR  or  GL_SINGLE_COLOR.
                 GL_SINGLE_COLOR specifies that a single color is
                 generated from the lighting  computation  for  a
                 vertex.    GL_SEPARATE_SPECULAR_COLOR  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

       GL_LIGHT_MODEL_TWO_SIDE
                 _param2 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 _param2 is 0  (or
                 0.0),  one-sided lighting is specified, and only
                 the front material parameters are  used  in  the
                 lighting  equation.  Otherwise, two-sided light-
                 ing is specified.  In  this  case,  vertices  of
                 back-facing  polygons are lighted using the back
                 material  parameters,  and  have  their  normals
                 reversed  before the lighting equation is evalu-
                 ated.  Vertices  of  front-facing  polygons  are
                 always  lighted using the front material parame-
                 ters, with no change to their normals. The  ini-
                 tial value is 0.

       In  RGBA mode, the lighted color of a vertex is the sum of
       the material emission intensity, the product of the  mate-
       rial 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 glMaterial using GL_COLOR_INDEXES.  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  equa-
       tions  as in the RGBA case, determine how much above ambi-
       ent the resulting index is.
       cuted between the execution of glBegin and the correspond-
       ing execution of glEnd.


ASSOCIATED GETS

       glGet with argument GL_LIGHT_MODEL_AMBIENT
       glGet with argument GL_LIGHT_MODEL_COLOR_CONTROL
       glGet with argument GL_LIGHT_MODEL_LOCAL_VIEWER
       glGet with argument GL_LIGHT_MODEL_TWO_SIDE
       glIsEnabled with argument GL_LIGHTING


SEE ALSO

       glLight, glMaterial



                                                                1