next up previous contents index
Next: 2.13.3 ColorMaterial Up: 2.13 Colors and Coloring Previous: Lighting Operation

2.13.2 Lighting Parameter Specification

 

Lighting parameters are divided into three categories: material parameters, light source parameters, and lighting model parameters (see Table 2.7). Sets of lighting parameters are specified with

void Material[if] ( enum face, enum pname, T param ) ;
void Material[if]v ( enum face, enum pname, T params ) ;
void Light[if] ( enum light, enum pname, T param ) ;
void Light[if]v ( enum light, enum pname, T params ) ;
void LightModel[if] ( enum pname, T param ) ;
void LightModel[if]v ( enum pname, T params ) ;

pname is a symbolic constant indicating which parameter is to be set (see Table 2.8). In the vector versions of the commands, params is a pointer to a group of values to which to set the indicated parameter. The number of values pointed to depends on the parameter being set. In the non-vector versions, param is a value to which to set a single-valued parameter. (If param corresponds to a multi-valued parameter, the error INVALID_ENUM results.) For the Material  command, face must be one of FRONT, BACK, or FRONT_AND_BACK, indicating that the property name of the front or back material, or both, respectively, should be set. In the case of Light , light is a symbolic constant of the form LIGHTi, indicating that light i is to have the specified parameter set. The constants obey .

Table 2.8 gives, for each of the three parameter groups, the correspondence between the pre-defined constant names and their names in the lighting equations, along with the number of values that must be specified with each. Color parameters specified with Material  and Light  are converted to floating-point values (if specified as integers) as indicated in Table 2.6 for signed integers. The error INVALID_VALUE occurs if a specified lighting parameter lies outside the allowable range given in Table 2.7. (The symbol ``'' indicates the maximum representable magnitude for the indicated type.)

  
Table 2.8: Correspondence of lighting parameter symbols to names. AMBIENT_AND_DIFFUSE is used to set and to the same value.

The current model-view matrix is applied to the position parameter indicated with Light  for a particular light source when that position is specified. These transformed values are the values used in the lighting equation.

The spotlight direction is transformed when it is specified using only the upper leftmost 3x3 portion of the model-view matrix. That is, if is the upper left 3x3 matrix taken from the current model-view matrix M, then the spotlight direction

is transformed to

An individual light is enabled or disabled by calling Enable  or Disable  with the symbolic value LIGHTi (i is in the range 0 to n-1, where n is the implementation-dependent number of lights). If light i is disabled, the ith term in the lighting equation is effectively removed from the summation.



next up previous contents index
Next: 2.13.3 ColorMaterial Up: 2.13 Colors and Coloring Previous: Lighting Operation



David Blythe
Sat Mar 29 02:23:21 PST 1997