1GLLIGHT(3G)                      OpenGL Manual                     GLLIGHT(3G)
2
3
4

NAME

6       glLight - set light source parameters
7

C SPECIFICATION

9       void glLightf(GLenum light, GLenum pname, GLfloat param);
10
11       void glLighti(GLenum light, GLenum pname, GLint param);
12

PARAMETERS

14       light
15           Specifies a light. The number of lights depends on the
16           implementation, but at least eight lights are supported. They are
17           identified by symbolic names of the form GL_LIGHT i, where i ranges
18           from 0 to the value of GL_MAX_LIGHTS - 1.
19
20       pname
21           Specifies a single-valued light source parameter for light.
22           GL_SPOT_EXPONENT, GL_SPOT_CUTOFF, GL_CONSTANT_ATTENUATION,
23           GL_LINEAR_ATTENUATION, and GL_QUADRATIC_ATTENUATION are accepted.
24
25       param
26           Specifies the value that parameter pname of light source light will
27           be set to.
28

C SPECIFICATION

30       void glLightfv(GLenum light, GLenum pname, const GLfloat * params);
31
32       void glLightiv(GLenum light, GLenum pname, const GLint * params);
33

PARAMETERS

35       light
36           Specifies a light. The number of lights depends on the
37           implementation, but at least eight lights are supported. They are
38           identified by symbolic names of the form GL_LIGHT i, where i ranges
39           from 0 to the value of GL_MAX_LIGHTS - 1.
40
41       pname
42           Specifies a light source parameter for light.  GL_AMBIENT,
43           GL_DIFFUSE, GL_SPECULAR, GL_POSITION, GL_SPOT_CUTOFF,
44           GL_SPOT_DIRECTION, GL_SPOT_EXPONENT, GL_CONSTANT_ATTENUATION,
45           GL_LINEAR_ATTENUATION, and GL_QUADRATIC_ATTENUATION are accepted.
46
47       params
48           Specifies a pointer to the value or values that parameter pname of
49           light source light will be set to.
50

DESCRIPTION

52       glLight sets the values of individual light source parameters.  light
53       names the light and is a symbolic name of the form GL_LIGHT i, where i
54       ranges from 0 to the value of GL_MAX_LIGHTS - 1.  pname specifies one
55       of ten light source parameters, again by symbolic name.  params is
56       either a single value or a pointer to an array that contains the new
57       values.
58
59       To enable and disable lighting calculation, call glEnable() and
60       glDisable() with argument GL_LIGHTING. Lighting is initially disabled.
61       When it is enabled, light sources that are enabled contribute to the
62       lighting calculation. Light source i is enabled and disabled using
63       glEnable() and glDisable() with argument GL_LIGHT i.
64
65       The ten light parameters are as follows:
66
67       GL_AMBIENT
68           params contains four integer or floating-point values that specify
69           the ambient RGBA intensity of the light. Integer values are mapped
70           linearly such that the most positive representable value maps to
71           1.0, and the most negative representable value maps to -1.0.
72           Floating-point values are mapped directly. Neither integer nor
73           floating-point values are clamped. The initial ambient light
74           intensity is (0, 0, 0, 1).
75
76       GL_DIFFUSE
77           params contains four integer or floating-point values that specify
78           the diffuse RGBA intensity of the light. Integer values are mapped
79           linearly such that the most positive representable value maps to
80           1.0, and the most negative representable value maps to -1.0.
81           Floating-point values are mapped directly. Neither integer nor
82           floating-point values are clamped. The initial value for GL_LIGHT0
83           is (1, 1, 1, 1); for other lights, the initial value is (0, 0, 0,
84           1).
85
86       GL_SPECULAR
87           params contains four integer or floating-point values that specify
88           the specular RGBA intensity of the light. Integer values are mapped
89           linearly such that the most positive representable value maps to
90           1.0, and the most negative representable value maps to -1.0.
91           Floating-point values are mapped directly. Neither integer nor
92           floating-point values are clamped. The initial value for GL_LIGHT0
93           is (1, 1, 1, 1); for other lights, the initial value is (0, 0, 0,
94           1).
95
96       GL_POSITION
97           params contains four integer or floating-point values that specify
98           the position of the light in homogeneous object coordinates. Both
99           integer and floating-point values are mapped directly. Neither
100           integer nor floating-point values are clamped.
101
102           The position is transformed by the modelview matrix when glLight is
103           called (just as if it were a point), and it is stored in eye
104           coordinates. If the w component of the position is 0, the light is
105           treated as a directional source. Diffuse and specular lighting
106           calculations take the light's direction, but not its actual
107           position, into account, and attenuation is disabled. Otherwise,
108           diffuse and specular lighting calculations are based on the actual
109           location of the light in eye coordinates, and attenuation is
110           enabled. The initial position is (0, 0, 1, 0); thus, the initial
111           light source is directional, parallel to, and in the direction of
112           the - z axis.
113
114       GL_SPOT_DIRECTION
115           params contains three integer or floating-point values that specify
116           the direction of the light in homogeneous object coordinates. Both
117           integer and floating-point values are mapped directly. Neither
118           integer nor floating-point values are clamped.
119
120           The spot direction is transformed by the upper 3x3 of the modelview
121           matrix when glLight is called, and it is stored in eye coordinates.
122           It is significant only when GL_SPOT_CUTOFF is not 180, which it is
123           initially. The initial direction is 0 0 -1.
124
125       GL_SPOT_EXPONENT
126           params is a single integer or floating-point value that specifies
127           the intensity distribution of the light. Integer and floating-point
128           values are mapped directly. Only values in the range 0 128 are
129           accepted.
130
131           Effective light intensity is attenuated by the cosine of the angle
132           between the direction of the light and the direction from the light
133           to the vertex being lighted, raised to the power of the spot
134           exponent. Thus, higher spot exponents result in a more focused
135           light source, regardless of the spot cutoff angle (see
136           GL_SPOT_CUTOFF, next paragraph). The initial spot exponent is 0,
137           resulting in uniform light distribution.
138
139       GL_SPOT_CUTOFF
140           params is a single integer or floating-point value that specifies
141           the maximum spread angle of a light source. Integer and
142           floating-point values are mapped directly. Only values in the range
143           0 90 and the special value 180 are accepted. If the angle between
144           the direction of the light and the direction from the light to the
145           vertex being lighted is greater than the spot cutoff angle, the
146           light is completely masked. Otherwise, its intensity is controlled
147           by the spot exponent and the attenuation factors. The initial spot
148           cutoff is 180, resulting in uniform light distribution.
149
150       GL_CONSTANT_ATTENUATION
151
152       GL_LINEAR_ATTENUATION
153
154       GL_QUADRATIC_ATTENUATION
155           params is a single integer or floating-point value that specifies
156           one of the three light attenuation factors. Integer and
157           floating-point values are mapped directly. Only nonnegative values
158           are accepted. If the light is positional, rather than directional,
159           its intensity is attenuated by the reciprocal of the sum of the
160           constant factor, the linear factor times the distance between the
161           light and the vertex being lighted, and the quadratic factor times
162           the square of the same distance. The initial attenuation factors
163           are (1, 0, 0), resulting in no attenuation.
164

NOTES

166       It is always the case that GL_LIGHT i = GL_LIGHT0 + i.
167

ERRORS

169       GL_INVALID_ENUM is generated if either light or pname is not an
170       accepted value.
171
172       GL_INVALID_VALUE is generated if a spot exponent value is specified
173       outside the range 0 128, or if spot cutoff is specified outside the
174       range 0 90 (except for the special value 180), or if a negative
175       attenuation factor is specified.
176
177       GL_INVALID_OPERATION is generated if glLight is executed between the
178       execution of glBegin() and the corresponding execution of glEnd().
179

ASSOCIATED GETS

181       glGetLight()
182
183       glIsEnabled() with argument GL_LIGHTING
184

SEE ALSO

186       glColorMaterial(), glLightModel(), glMaterial()
187
189       Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
190       under the SGI Free Software B License. For details, see
191       http://oss.sgi.com/projects/FreeB/.
192

AUTHORS

194       opengl.org
195
196
197
198opengl.org                        07/13/2018                       GLLIGHT(3G)
Impressum