1GLLIGHTMODEL(3G) OpenGL Manual GLLIGHTMODEL(3G)
2
3
4
6 glLightModel - set the lighting model parameters
7
9 void glLightModelf(GLenum pname, GLfloat param);
10
11 void glLightModeli(GLenum pname, GLint param);
12
14 pname
15 Specifies a single-valued lighting model parameter.
16 GL_LIGHT_MODEL_LOCAL_VIEWER, GL_LIGHT_MODEL_COLOR_CONTROL, and
17 GL_LIGHT_MODEL_TWO_SIDE are accepted.
18
19 param
20 Specifies the value that param will be set to.
21
23 void glLightModelfv(GLenum pname, const GLfloat * params);
24
25 void glLightModeliv(GLenum pname, const GLint * params);
26
28 pname
29 Specifies a lighting model parameter. GL_LIGHT_MODEL_AMBIENT,
30 GL_LIGHT_MODEL_COLOR_CONTROL, GL_LIGHT_MODEL_LOCAL_VIEWER, and
31 GL_LIGHT_MODEL_TWO_SIDE are accepted.
32
33 params
34 Specifies a pointer to the value or values that params will be set
35 to.
36
38 glLightModel sets the lighting model parameter. pname names a
39 parameter and params gives the new value. There are three lighting
40 model parameters:
41
42 GL_LIGHT_MODEL_AMBIENT
43
44 params contains four integer or floating-point values that specify
45 the ambient RGBA intensity of the entire scene. Integer values are
46 mapped linearly such that the most positive representable value
47 maps to 1.0, and the most negative representable value maps to
48 -1.0. Floating-point values are mapped directly. Neither integer
49 nor floating-point values are clamped. The initial ambient scene
50 intensity is (0.2, 0.2, 0.2, 1.0).
51
52 GL_LIGHT_MODEL_COLOR_CONTROL
53
54 params must be either GL_SEPARATE_SPECULAR_COLOR or
55 GL_SINGLE_COLOR. GL_SINGLE_COLOR specifies that a single color is
56 generated from the lighting computation for a vertex.
57 GL_SEPARATE_SPECULAR_COLOR specifies that the specular color
58 computation of lighting be stored separately from the remainder of
59 the lighting computation. The specular color is summed into the
60 generated fragment's color after the application of texture mapping
61 (if enabled). The initial value is GL_SINGLE_COLOR.
62
63 GL_LIGHT_MODEL_LOCAL_VIEWER
64
65 params is a single integer or floating-point value that specifies
66 how specular reflection angles are computed. If params is 0 (or
67 0.0), specular reflection angles take the view direction to be
68 parallel to and in the direction of the -z axis, regardless of the
69 location of the vertex in eye coordinates. Otherwise, specular
70 reflections are computed from the origin of the eye coordinate
71 system. The initial value is 0.
72
73 GL_LIGHT_MODEL_TWO_SIDE
74
75 params is a single integer or floating-point value that specifies
76 whether one- or two-sided lighting calculations are done for
77 polygons. It has no effect on the lighting calculations for points,
78 lines, or bitmaps. If params is 0 (or 0.0), one-sided lighting is
79 specified, and only the front material parameters are used in the
80 lighting equation. Otherwise, two-sided lighting is specified. In
81 this case, vertices of back-facing polygons are lighted using the
82 back material parameters and have their normals reversed before the
83 lighting equation is evaluated. Vertices of front-facing polygons
84 are always lighted using the front material parameters, with no
85 change to their normals. The initial value is 0.
86
87 In RGBA mode, the lighted color of a vertex is the sum of the material
88 emission intensity, the product of the material ambient reflectance and
89 the lighting model full-scene ambient intensity, and the contribution
90 of each enabled light source. Each light source contributes the sum of
91 three terms: ambient, diffuse, and specular. The ambient light source
92 contribution is the product of the material ambient reflectance and the
93 light's ambient intensity. The diffuse light source contribution is the
94 product of the material diffuse reflectance, the light's diffuse
95 intensity, and the dot product of the vertex's normal with the
96 normalized vector from the vertex to the light source. The specular
97 light source contribution is the product of the material specular
98 reflectance, the light's specular intensity, and the dot product of the
99 normalized vertex-to-eye and vertex-to-light vectors, raised to the
100 power of the shininess of the material. All three light source
101 contributions are attenuated equally based on the distance from the
102 vertex to the light source and on light source direction, spread
103 exponent, and spread cutoff angle. All dot products are replaced with 0
104 if they evaluate to a negative value.
105
106 The alpha component of the resulting lighted color is set to the alpha
107 value of the material diffuse reflectance.
108
109 In color index mode, the value of the lighted index of a vertex ranges
110 from the ambient to the specular values passed to glMaterial() using
111 GL_COLOR_INDEXES. Diffuse and specular coefficients, computed with a
112 (.30, .59, .11) weighting of the lights' colors, the shininess of the
113 material, and the same reflection and attenuation equations as in the
114 RGBA case, determine how much above ambient the resulting index is.
115
117 GL_LIGHT_MODEL_COLOR_CONTROL is available only if the GL version is 1.2
118 or greater.
119
121 GL_INVALID_ENUM is generated if pname is not an accepted value.
122
123 GL_INVALID_ENUM is generated if pname is GL_LIGHT_MODEL_COLOR_CONTROL
124 and params is not one of GL_SINGLE_COLOR or GL_SEPARATE_SPECULAR_COLOR.
125
126 GL_INVALID_OPERATION is generated if glLightModel is executed between
127 the execution of glBegin() and the corresponding execution of glEnd().
128
130 glGet() with argument GL_LIGHT_MODEL_AMBIENT
131
132 glGet() with argument GL_LIGHT_MODEL_COLOR_CONTROL
133
134 glGet() with argument GL_LIGHT_MODEL_LOCAL_VIEWER
135
136 glGet() with argument GL_LIGHT_MODEL_TWO_SIDE
137
138 glIsEnabled() with argument GL_LIGHTING
139
141 glLight(), glMaterial()
142
144 Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
145 under the SGI Free Software B License. For details, see
146 http://oss.sgi.com/projects/FreeB/.
147
149 opengl.org
150
151
152
153opengl.org 06/10/2014 GLLIGHTMODEL(3G)