C SPECIFICATION
void GLAPIENTRY glLightf( GLenum light,
GLenum pname,
GLfloat param )
void GLAPIENTRY glLighti( GLenum light,
GLenum pname,
GLint param )
PARAMETERS
light Specifies a light. The number of lights depends on the imple-
mentation, but at least eight lights are supported. They are
identified by symbolic names of the form GL_LIGHTi where 0 <= i <
GL_MAX_LIGHTS.
pname Specifies a single-valued light source parameter for light.
GL_SPOT_EXPONENT, GL_SPOT_CUTOFF, GL_CONSTANT_ATTENUATION,
GL_LINEAR_ATTENUATION, and GL_QUADRATIC_ATTENUATION are
accepted.
param Specifies the value that parameter pname of light source light
will be set to.
C SPECIFICATION
void GLAPIENTRY glLightfv( GLenum light,
GLenum pnam )
void GLAPIENTRY glLightiv( GLenum light,
GLenum pnam )
PARAMETERS
light Specifies a light. The number of lights depends on the imple-
mentation, but at least eight lights are supported. They are
identified by symbolic names of the form GL_LIGHTi where 0 <= i <
GL_MAX_LIGHTS.
pnam Specifies a light source parameter for light. GL_AMBIENT,
GL_DIFFUSE, GL_SPECULAR, GL_POSITION, GL_SPOT_CUTOFF,
GL_SPOT_DIRECTION, GL_SPOT_EXPONENT, GL_CONSTANT_ATTENUATION,
GL_LINEAR_ATTENUATION, and GL_QUADRATIC_ATTENUATION are
accepted.
Specifies a pointer to the value or values that parameter pnam
of light source light will be set to.
DESCRIPTION
glLight sets the values of individual light source parameters. light
names the light and is a symbolic name of the form GL_LIGHTi, where 0 <=
i < GL_MAX_LIGHTS. pnam specifies one of ten light source parameters,
again by symbolic name.
that the most positive 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 val-
ues are clamped. The initial ambient light inten-
sity is (0, 0, 0, 1).
GL_DIFFUSE contains four integer or floating-point values
that specify the diffuse RGBA intensity of the
light. Integer values are mapped linearly such
that the most positive 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 val-
ues are clamped. The initial value for GL_LIGHT0
is (1, 1, 1, 1); for other lights, the initial
value is (0, 0, 0, 0).
GL_SPECULAR contains four integer or floating-point values
that specify the specular RGBA intensity of the
light. Integer values are mapped linearly such
that the most positive 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 val-
ues are clamped. The initial value for GL_LIGHT0
is (1, 1, 1, 1); for other lights, the initial
value is (0, 0, 0, 0).
GL_POSITION contains four integer or floating-point values
that specify the position of the light in homoge-
neous object coordinates. Both integer and float-
ing-point values are mapped directly. Neither
integer nor floating-point values are clamped.
The position is transformed by the modelview matrix
when glLight is called (just as if it were a
point), and it is stored in eye coordinates. If
the w component of the position is 0, the light is
treated as a directional source. Diffuse and spec-
ular lighting calculations take the light's direc-
tion, but not its actual position, into account,
and attenuation is disabled. Otherwise, diffuse
and specular lighting calculations are based on the
actual location of the light in eye coordinates,
and attenuation is enabled. The initial position
is (0, 0, 1, 0); thus, the initial light source is
directional, parallel to, and in the direction of
the -z axis.
GL_SPOT_DIRECTION contains three integer or floating-point values
that specify the direction of the light in homoge-
directly. Only values in the range [0,128] are
accepted.
Effective light intensity is attenuated by the
cosine of the angle between the direction of the
light and the direction from the light to the ver-
tex being lighted, raised to the power of the spot
exponent. Thus, higher spot exponents result in a
more focused light source, regardless of the spot
cutoff angle (see GL_SPOT_CUTOFF, next paragraph).
The initial spot exponent is 0, resulting in uni-
form light distribution.
GL_SPOT_CUTOFF is a single integer or floating-point value that
specifies the maximum spread angle of a light
source. Integer and floating-point values are
mapped directly. Only values in the range [0,90]
and the special value 180 are accepted. If the
angle between the direction of the light and the
direction from the light to the vertex being
lighted is greater than the spot cutoff angle, the
light is completely masked. Otherwise, its inten-
sity is controlled by the spot exponent and the
attenuation factors. The initial spot cutoff is
180, resulting in uniform light distribution.
GL_CONSTANT_ATTENUATION
GL_LINEAR_ATTENUATION
GL_QUADRATIC_ATTENUATION
is a single integer or floating-point value that
specifies one of the three light attenuation fac-
tors. Integer and floating-point values are mapped
directly. Only nonnegative values are accepted.
If the light is positional, rather than direc-
tional, its intensity is attenuated by the recipro-
cal of the sum of the constant factor, the linear
factor times the distance between the light and the
vertex being lighted, and the quadratic factor
times the square of the same distance. The initial
attenuation factors are (1, 0, 0), resulting in no
attenuation.
NOTES
It is always the case that GL_LIGHTi = GL_LIGHT0 + i.
ERRORS
GL_INVALID_ENUM is generated if either light or pnam is not an accepted
value.
GL_INVALID_VALUE is generated if a spot exponent value is specified
GLLIGHT(3G)
Man(1) output converted with
man2html