1GLLIGHTMODEL(3G)                                              GLLIGHTMODEL(3G)
2
3
4

NAME

6       glLightModelf,  glLightModeli, glLightModelfv, glLightModeliv - set the
7       lighting model parameters
8
9

C SPECIFICATION

11       void glLightModelf( GLenum pname,
12                           GLfloat param )
13       void glLightModeli( GLenum pname,
14                           GLint param )
15
16

PARAMETERS

18       pname   Specifies   a   single-valued   lighting    model    parameter.
19               GL_LIGHT_MODEL_LOCAL_VIEWER,  GL_LIGHT_MODEL_COLOR_CONTROL, and
20               GL_LIGHT_MODEL_TWO_SIDE are accepted.
21
22       param   Specifies the value that param will be set to.
23

C SPECIFICATION

25       void glLightModelfv( GLenum pname,
26                            const GLfloat *params )
27       void glLightModeliv( GLenum pname,
28                            const GLint *params )
29
30

PARAMETERS

32       pname  Specifies a lighting model  parameter.   GL_LIGHT_MODEL_AMBIENT,
33              GL_LIGHT_MODEL_COLOR_CONTROL,  GL_LIGHT_MODEL_LOCAL_VIEWER,  and
34              GL_LIGHT_MODEL_TWO_SIDE are accepted.
35
36       params Specifies a pointer to the value or values that params  will  be
37              set to.
38

DESCRIPTION

40       glLightModel  sets the lighting model parameter.  pname names a parame‐
41       ter and params gives the new value.  There  are  three  lighting  model
42       parameters:
43
44       GL_LIGHT_MODEL_AMBIENT
45                 params  contains  four  integer or floating-point values that
46                 specify the ambient  RGBA  intensity  of  the  entire  scene.
47                 Integer  values  are mapped linearly such that the most posi‐
48                 tive representable value maps to 1.0, and the  most  negative
49                 representable  value maps to -1.0.  Floating-point values are
50                 mapped directly.  Neither integer nor  floating-point  values
51                 are  clamped.   The  initial ambient scene intensity is (0.2,
52                 0.2, 0.2, 1.0).
53
54       GL_LIGHT_MODEL_COLOR_CONTROL
55                 params   must   be   either   GL_SEPARATE_SPECULAR_COLOR   or
56                 GL_SINGLE_COLOR.   GL_SINGLE_COLOR  specifies  that  a single
57                 color is generated from the lighting computation for  a  ver‐
58                 tex.   GL_SEPARATE_SPECULAR_COLOR specifies that the specular
59                 color computation of lighting be stored separately  from  the
60                 remainder of the lighting computation.  The specular color is
61                 summed into the generated fragment's color after the applica‐
62                 tion  of  texture mapping (if enabled).  The initial value is
63                 GL_SINGLE_COLOR.
64
65       GL_LIGHT_MODEL_LOCAL_VIEWER
66                 params is a single integer or floating-point value that spec‐
67                 ifies how specular reflection angles are computed.  If params
68                 is 0 (or 0.0),  specular  reflection  angles  take  the  view
69                 direction  to  be  parallel to and in the direction of the -z
70                 axis, regardless of the location of the vertex in eye coordi‐
71                 nates.  Otherwise, specular reflections are computed from the
72                 origin of the eye coordinate system.  The initial value is 0.
73
74       GL_LIGHT_MODEL_TWO_SIDE
75                 params is a single integer or floating-point value that spec‐
76                 ifies  whether  one-  or  two-sided lighting calculations are
77                 done for polygons.  It has no effect on the lighting calcula‐
78                 tions  for  points,  lines,  or  bitmaps.  If params is 0 (or
79                 0.0), one-sided lighting is specified,  and  only  the  front
80                 material  parameters are used in the lighting equation.  Oth‐
81                 erwise, two-sided lighting is specified.  In this case,  ver‐
82                 tices  of  back-facing  polygons  are  lighted using the back
83                 material parameters, and have their normals  reversed  before
84                 the lighting equation is evaluated.  Vertices of front-facing
85                 polygons are always lighted using the front material  parame‐
86                 ters,  with  no change to their normals. The initial value is
87                 0.
88
89       In RGBA mode, the lighted color of a vertex is the sum of the  material
90       emission intensity, the product of the material ambient reflectance and
91       the lighting model full-scene ambient intensity, and  the  contribution
92       of each enabled light source.  Each light source contributes the sum of
93       three terms: ambient, diffuse, and specular.  The ambient light  source
94       contribution is the product of the material ambient reflectance and the
95       light's ambient intensity.  The diffuse light  source  contribution  is
96       the  product  of  the material diffuse reflectance, the light's diffuse
97       intensity, and the dot product of the vertex's normal with the  normal‐
98       ized  vector  from  the vertex to the light source.  The specular light
99       source  contribution  is  the  product   of   the   material   specular
100       reflectance, the light's specular intensity, and the dot product of the
101       normalized vertex-to-eye and vertex-to-light  vectors,  raised  to  the
102       power of the shininess of the material.  All three light source contri‐
103       butions are attenuated equally based on the distance from the vertex to
104       the  light  source  and on light source direction, spread exponent, and
105       spread cutoff angle.  All dot products are  replaced  with  0  if  they
106       evaluate to a negative value.
107
108       The  alpha component of the resulting lighted color is set to the alpha
109       value of the material diffuse reflectance.
110
111       In color index mode, the value of the lighted index of a vertex  ranges
112       from  the  ambient  to  the  specular values passed to glMaterial using
113       GL_COLOR_INDEXES.  Diffuse and specular coefficients, computed  with  a
114       (.30,  .59,  .11) weighting of the lights' colors, the shininess of the
115       material, and the same reflection and attenuation equations as  in  the
116       RGBA case, determine how much above ambient the resulting index is.
117

NOTES

119       GL_LIGHT_MODEL_COLOR_CONTROL is available only if the GL version is 1.2
120       or greater.
121

ERRORS

123       GL_INVALID_ENUM is generated if pname is not an accepted value.
124
125       GL_INVALID_ENUM is generated if pname  is  GL_LIGHT_MODEL_COLOR_CONTROL
126       and params is not one of GL_SINGLE_COLOR or GL_SEPARATE_SPECULAR_COLOR.
127
128       GL_INVALID_OPERATION  is  generated if glLightModel is executed between
129       the execution of glBegin and the corresponding execution of glEnd.
130

ASSOCIATED GETS

132       glGet with argument GL_LIGHT_MODEL_AMBIENT
133       glGet with argument GL_LIGHT_MODEL_COLOR_CONTROL
134       glGet with argument GL_LIGHT_MODEL_LOCAL_VIEWER
135       glGet with argument GL_LIGHT_MODEL_TWO_SIDE
136       glIsEnabled with argument GL_LIGHTING
137

SEE ALSO

139       glLight(3G), glMaterial(3G)
140
141
142
143                                                              GLLIGHTMODEL(3G)
Impressum