Light( n, argument, value, ... value )
Note: To turn each light on, issue an Enable (Lighting) and an Enable (lightn) command, where n is the light number. Then, move the light to a position in the scene with a Light(n, POSITION, x, y, z) command.
The value of argument can be any one of those shown in Light Arguments and Default Values. The table shows default values for each argument.
AMBIENT
DIFFUSE
SPECULAR
POSITION
(x, y, z, w) position
SPOT_DIRECTION
(x, y, z) direction of spotlight
SPOT_EXPONENT
SPOT_CUTOFF
CONSTANT_ATTENUATION
LINEAR_ATTENUATION
QUADRATIC_ATTENUATION
Note: The default values for DIFFUSE and SPECULAR in this table only apply to Light 0. For other lights, the default value is (0, 0, 0, 1) for both arguments.
The first three arguments (AMBIENT, DIFFUSE, and SPECULAR) are used to color the light. DIFFUSE is the argument that is most closely associated with the physical color of the light. AMBIENT refers to the property of the light when it functions as a background light. SPECULAR alters the way a light is reflected off a surface.
Specify the position of the light using the POSITION argument. Nonzero values of the fourth (w) coordinate position the light in homogenous object coordinates.
where c = CONSTANT_ATTENUATION, l = LINEAR_ATTENUATION, and q = QUADRATIC_ATTENUATION.
To create a spotlight, limit the shape of the light to a cone. Use the SPOT_CUTOFF argument to define the side of the cone, as shown in the following illustration.
Spotlight
In addition to the cutoff angle, you can control the intensity and direction of the light distribution in the cone. SPOT_DIRECTION specifies the direction for the spotlight to point; SPOT_EXPONENT influences how concentrated the light is.