MyWebUniversity.com Home Page
 



Darwin Mac OS X man pages main menu
GLIGHTMODEL(3G)                                              GLIGHTMODEL(3G)



NAME
       glLightodelf,,  glLightodeli,, glLightodelfv,, glLightodeliv - set the
       lighting model parameters


C SPECIFICATION
       void glLightodelf( GLenum pname,
                           GLfloat param )
       void glLightodeli( GLenum pname,
                           GLint param )


PARAMETERS
       pname   Specifies   a   single-valued   lighting    model    parameter.
               GLIGHTMODELOCALVIEWER,  GLIGHTMODELCOLORCONTROL, and
               GLIGHTMODELTWOSIDE are accepted.

       param   Specifies the value that param will be set to.

C SPECIFICATION
       void glLightodelfv( GLenum pname,
                            const GLfloat *params )
       void glLightodeliv( GLenum pname,
                            const GLint *params )


PARAMETERS
       pname  Specifies a lighting model  parameter.   GLIGHTMODELAMBIENT,
              GLIGHTMODELCOLORCONTROL,  GLIGHTMODELOCALVIEWER,  and
              GLIGHTMODELTWOSIDE are accepted.

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

DESCRIPTION
       glLightodel  sets the lighting model parameter.  pname names a parame-
       ter and params gives the new value.  There  are  three  lighting  model
       parameters:

       GLIGHTMODELAMBIENT
                 params  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 posi-
                 tive 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).

       GLIGHTMODELCOLORCONTROL
                 params   must   be   either   GLSEPARATESPECULARCOLOR   or
                 GLSINGLECOLOR.   GLSINGLECOLOR  specifies  that  a single
                 color is generated from the lighting computation for  a  ver-
                 tex.   GLSEPARATESPECULARCOLOR 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 applica-
                 tion  of  texture mapping (if enabled).  The initial value is
                 GLSINGLECOLOR.

       GLIGHTMODELOCALVIEWER
                 params is a single integer or floating-point value that spec-
                 ifies how specular reflection angles are computed.  If params
                 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 coordi-
                 nates.  Otherwise, specular reflections are computed from the
                 origin of the eye coordinate system.  The initial value is 0.

       GLIGHTMODELTWOSIDE
                 params is a single integer or floating-point value that spec-
                 ifies whether one- or  two-sided  lighting  calculations  are
                 done for polygons.  It has no effect on the lighting calcula-
                 tions for points, lines, or bitmaps.   If  params  is  0  (or
                 0.0),  one-sided  lighting  is  specified, and only the front
                 material parameters are used in the lighting equation.   Oth-
                 erwise,  two-sided lighting is specified.  In this case, ver-
                 tices of back-facing polygons  are  lighted  using  the  back
                 material  parameters,  and have their normals reversed before
                 the lighting equation is evaluated.  Vertices of front-facing
                 polygons  are always lighted using the front material parame-
                 ters, 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 normal-
       ized 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 contri-
       butions 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  glaterial  using
       GLCOLORINDEXES.   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
       GLIGHTMODELCOLORCONTROL is available only if the GL version is 1.2
       or greater.

ERORS
       GLINVALIDENUM is generated if pname is not an accepted value.

       GLINVALIDENUM  is  generated if pname is GLIGHTMODELCOLORCONTROL
       and params is not one of GLSINGLECOLOR or GLSEPARATESPECULARCOLOR.

       GLINVALIDOPERATION  is  generated if glLightodel is executed between
       the execution of glBegin and the corresponding execution of glEnd.

ASOCIATED GETS
       glGet with argument GLIGHTMODELAMBIENT
       glGet with argument GLIGHTMODELCOLORCONTROL
       glGet with argument GLIGHTMODELOCALVIEWER
       glGet with argument GLIGHTMODELTWOSIDE
       glIsEnabled with argument GLIGHTING

SEE ALSO
       glLight, glaterial



                                                              GLIGHTMODEL(3G)
Darwin Mac OS X man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™