lmdef(3G) lmdef(3G)
NAME
lmdef - defines a new material, light, or lighting model
SPECIFICATION
C
lmdef(deftype, index, np, properties)
long deftype, index;
long np;
float properties[];
FORTRAN
subroutine lmdef(deftype, index, np, properties)
integer*4 deftype, index
integer*4 np;
real properties(np)
DESCRIPTION
lmdef defines a new material, light, or lighting model.
deftype is either DEFMATERIAL, DEFLIGHT, or DEFLMODEL, and
determines what is being defined.
index is the index into the table of stored materials,
lights, or lighting models. Indexes for each of these
groups are independent.
np is the number of floating point values in the properties
array.
properties is a list of properties to be assigned to the
material, light, or lighting model. Values in the array are
command tokens, each followed by the appropriate number of
data values. All command tokens and data values are
floating point numbers. properties should include only
command tokens appropriate to the object being defined. The
last command token must be LMNULL(0.0). Command tokens are
defined in the file gl.h.
The default values of all properties provide the most
efficient execution. Lighting model performance is best if
relatively few properties are changed. A definition can be
reset to all default values by either:
Calling lmdef with a null pointer to the properties
array (C only), or
Calling lmdef with LMNULL(0.0) as the first command
token in the properties array.
If no changes are made to the default values, objects are
lighted to various shades of gray by a white light behind
Page 1 (printed 8/20/87)
lmdef(3G) lmdef(3G)
the viewer's head. Viewer and light are assumed to be
infinitely distant for the purpose of lighting calculations.
There is a small amount of ambient light, but no specular
light. Distance attenuation is defeated.
Incremental changes can be made to a material, light, or
lighting model definition. Each lmdef changes only the
properties specified in the properties array. Properties
that are not specified in the properties array keep their
previous values. Any property can be changed whether or not
that property affects the current lighting model. Changes
made to a definition that is currently bound (see lmbind )
are effective immediately.
Index 0 is predefined for each of materials, lights, and
lighting models. These definitions cannot be changed and
are:
DEFMATERIAL 0
No lighting calculations are done. Binding material 0 is the most
efficient method to disable the lighting calculations.
It is equivalent in functionality to lighting model 0.
DEFLIGHT 0
No lighting calculations are done for this light. Binding
light 0 to a light turns off that light.
DEFLMODEL 0
No lighting calculations are done.
SEE ALSO
lmbind, normal, color, RGBcolor
Programming Guide, Section 14.4
NOTE
This routine is available only in immediate mode.
Page 2 (printed 8/20/87)