Light
The Light function sets the values of individual light source parameters.
These functions set light source parameters.
Light( thelight, pname, param, 0, 0, 0);
The thelight parameter names the light and is a symbolic name of the form:
GL_LIGHTi, where 0 <= i < GL_MAX_LIGHTS (8)
Arguments:
thelight
A light. The number of lights depends on the implementation, 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
A single-valued light source parameter for light. The following values are accepted.
GL_SPOT_EXPONENT
The param parameter is a single integer or floating-point value that specifies the intensity distribution of the light. Integer and floating-point values are mapped 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 vertex 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 the following paragraph). The default spot exponent is 0, resulting in uniform light distribution.
GL_SPOT_CUTOFF
The param parameter 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, then the light is completely masked. Otherwise, its intensity is controlled by the spot exponent and the attenuation factors. The default spot cutoff is 180, resulting in uniform light distribution.
GL_CONSTANT_ATTENUATION
GL_LINEAR_ATTENUATION
GL_QUADRATIC_ATTENUATION
The param parameter is a single integer or floating-point value that specifies one of the three light attenuation factors. Integer and floating-point values are mapped directly. Only nonnegative values are accepted. If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of the sum of: the constant factor, the linear factor multiplied by the distance between the light and the vertex being lighted, and the quadratic factor multiplied by the square of the same distance. The default attenuation factors are (1,0,0), resulting in no attenuation.
param
The value to which parameter pname of light source light will be set.
Lighting calculation is enabled and disabled using Enable and Disable with argument GL_LIGHTING. When lighting is enabled, light sources that are enabled contribute to the lighting calculation. Light source i is enabled and disabled using Enable and Disable with argument GL_LIGHTi.
It is always the case that GL_LIGHTi = GL_LIGHT0 + i.
Note: Do not call Light between a call to Begin and the corresponding call to End.
See Also