glFragmentLight(3G) OpenGL Reference glFragmentLight(3G)
glFragmentLightfSGIX, glFragmentLightiSGIX, glFragmentLightfvSGIX,
glFragmentLightivSGIX - set fragment light source parameters
void glFragmentLightfSGIX( GLenum light,
GLenum pname,
GLfloat param )
void glFragmentLightiSGIX( GLenum light,
GLenum pname,
GLint param )
light Specifies a fragment light. The number of fragment lights
depends on the implementation. They are identified by names of
the form GL_FRAGMENT_LIGHTi_SGIX where 0 < i <
GL_MAX_FRAGMENT_LIGHTS_SGIX.
pname Specifies a single-valued fragment 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 fragment light source
light will be set to.
void glFragmentLightfvSGIX( GLenum light,
GLenum pname,
const GLfloat *params )
void glFragmentLightivSGIX( GLenum light,
GLenum pname,
const GLint *params )
light
Specifies a fragment light. The number of fragment lights depends
on the implementation. They are identified by names of the form
GL_FRAGMENT_LIGHTi_SGIX where 0 < i < GL_MAX_FRAGMENT_LIGHTS_SGIX.
pname
Specifies a fragment 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.
params
Specifies a pointer to the value or values that parameter pname of
fragment light source light will be set to.
Page 1
glFragmentLight(3G) OpenGL Reference glFragmentLight(3G)
glFragmentLight sets the values of individual fragment light source
parameters. light names the fragment light and is a symbolic name of the
form GL_FRAGMENT_LIGHTi_SGIX, where 0 < i < GL_MAX_FRAGMENT_LIGHTS_SGIX.
pname specifies one of ten fragment light source parameters, again by
symbolic name. params is either a single value or a pointer to an array
that contains the new values.
To enable and disable fragment lighting calculation, call glEnable and
glDisable with argument GL_FRAGMENT_LIGHTING_SGIX. Fragment lighting is
initially disabled. When it is enabled, light sources that are enabled
contribute to the fragment lighting calculation. Fragment light source i
is enabled and disabled using glEnable and glDisable with argument
GL_FRAGMENT_LIGHTi_SGIX.
The ten fragment light parameters are as follows:
GL_AMBIENT params contains four integer or floating-point values
that specify the ambient RGBA intensity of the
fragment 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 values
are clamped. The initial ambient fragment light
intensity is (0, 0, 0, 1).
GL_DIFFUSE params contains four integer or floating-point values
that specify the diffuse RGBA intensity of the
fragment 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 values
are clamped. The initial value for
GL_FRAGMENT_LIGHT0_SGIX is (1, 1, 1, 1); for other
fragment lights, the initial value is (0, 0, 0, 0).
GL_SPECULAR params contains four integer or floating-point values
that specify the specular RGBA intensity of the
fragment 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 values
are clamped. The initial value for
GL_FRAGMENT_LIGHT0_SGIX is (1, 1, 1, 1); for other
fragment lights, the initial value is (0, 0, 0, 0).
GL_POSITION params contains four integer or floating-point values
that specify the position of the fragment light in
homogeneous object coordinates. Both integer and
Page 2
glFragmentLight(3G) OpenGL Reference glFragmentLight(3G)
floating-point values are mapped directly. Neither
integer nor floating-point values are clamped.
The position is transformed by the modelview matrix
when glFragmentLight 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 fragment light
is treated as a directional source. Diffuse and
specular fragment lighting calculations take the
light's direction, but not its actual position, into
account, and attenuation is disabled. Otherwise,
diffuse and specular fragment lighting calculations
are based on the actual location of the fragment
light in eye coordinates, and attenuation is enabled.
The initial position is (0, 0, 1, 0); thus, the
initial fragment light source is directional,
parallel to, and in the direction of the -z axis.
GL_SPOT_DIRECTION params contains three integer or floating-point
values that specify the direction of the fragment
light in homogeneous object coordinates. Both
integer and floating-point values are mapped
directly. Neither integer nor floating-point values
are clamped.
The spot direction is transformed by the inverse of
the modelview matrix when glFragmentLight is called
(just as if it were a normal), and it is stored in
eye coordinates. It is significant only when
GL_SPOT_CUTOFF is not 180, which it is initially.
The initial direction is (0, 0, -1).
GL_SPOT_EXPONENT params is a single integer or floating-point value
that specifies the intensity distribution of the
fragment light. Integer and floating-point values
are mapped directly. Only values in the range
[0,128] are accepted.
Effective fragment light intensity is attenuated by
the cosine of the angle between the direction of the
fragment light and the direction from the fragment
light to the vertex being lighted, raised to the
power of the spot exponent. Thus, higher spot
exponents result in a more focused fragment light
source, regardless of the spot cutoff angle (see
GL_SPOT_CUTOFF, next paragraph). The initial spot
exponent is 0, resulting in uniform fragment light
distribution.
GL_SPOT_CUTOFF params is a single integer or floating-point value
that specifies the maximum spread angle of a fragment
light source. Integer and floating-point values are
Page 3
glFragmentLight(3G) OpenGL Reference glFragmentLight(3G)
mapped directly. Only values in the range [0,90] and
the special value 180 are accepted. If the angle
between the direction of the fragment light and the
direction from the light to the vertex being lighted
is greater than the spot cutoff angle, the fragment
light is completely masked. Otherwise, its intensity
is controlled by the spot exponent and the
attenuation factors. The initial spot cutoff is 180,
resulting in uniform fragment light distribution.
GL_CONSTANT_ATTENUATION [Toc] [Back]
GL_LINEAR_ATTENUATION [Toc] [Back]
GL_QUADRATIC_ATTENUATION [Toc] [Back]
params is a single integer or floating-point value
that specifies one of the three fragment light
attenuation factors. Integer and floating-point
values are mapped directly. Only nonnegative values
are accepted. If the fragment light is positional,
rather than directional, its intensity is attenuated
by the reciprocal of the sum of the constant factor,
the linear factor times the distance between the
fragment 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.
It is always the case that GL_FRAGMENT_LIGHTi_SGIX =
GL_FRAGMENT_LIGHT0_SGIX + i.
GL_INVALID_ENUM is generated if either light or pname is not an accepted
value.
GL_INVALID_VALUE is generated if a spot exponent value is specified
outside the range [0,128], or if spot cutoff is specified outside the
range [0,90] (except for the special value 180), or if a negative
attenuation factor is specified.
GL_INVALID_OPERATION is generated if glFragmentLight is executed between
the execution of glBegin and the corresponding execution of glEnd.
glGetFragmentLight
glIsEnabled with argument GL_FRAGMENT_LIGHTING_SGIX
Page 4
glFragmentLight(3G) OpenGL Reference glFragmentLight(3G)
MACHINE DEPENDENCIES
The SGIX_fragment_lighting extension is supported only on Octane2 VPro
systems.
On Octane2 VPro systems, use of the texture q coordinate to achieve
projective texture effects will be processed on a per-vertex basis
instead of a per-pixel basis, unless the the texture matrix is set up to
be projective. (A projective texture matrix is defined to be one in
which any of the 13th, 14th or 15th elements is non-zero.) In addition,
if either two-sided lighting or fragment lighting is in effect,
projective texture effects will always be processed on a per-vertex
basis.
glFragmentColorMaterial, glFragmentLightModel, glFragmentMaterial
PPPPaaaaggggeeee 5555 [ Back ]
|