MyWebUniversity.com Home Page
 



Darwin Mac OS X man pages main menu
GLMATERIAL(3G)                                                  GLMATERIAL(3G)



NAME
       glaterialf,, glateriali,, glaterialfv,, glaterialiv - specify material
       parameters for the lighting model


C SPECIFICATION
       void glaterialf( GLenum face,
                         GLenum pname,
                         GLfloat param )
       void glateriali( GLenum face,
                         GLenum pname,
                         GLint param )


PARAMETERS
       face    Specifies which face or faces are being updated.  Must  be  one
               of GLFRONT, GLBACK, or GLFRONTANDBACK.

       pname   Specifies  the  single-valued material parameter of the face or
               faces that is being updated.  Must be GLSHININES.

       param   Specifies the value that parameter GLSHININES will be set to.

C SPECIFICATION
       void glaterialfv( GLenum face,
                          GLenum pname,
                          const GLfloat *params )
       void glaterialiv( GLenum face,
                          GLenum pname,
                          const GLint *params )


PARAMETERS
       face   Specifies which face or faces are being updated.  Must be one of
              GLFRONT, GLBACK, or GLFRONTANDBACK.

       pname  Specifies the material parameter of the face or  faces  that  is
              being   updated.    Must   be  one  of  GLAMBIENT,  GLDIFUSE,
              GLSPECULAR, GLEMISION, GLSHININES,  GLAMBIENTANDIFUSE,
              or GLCOLORINDEXES.

       params Specifies  a  pointer  to the value or values that pname will be
              set to.

DESCRIPTION
       glaterial assigns  values  to  material  parameters.   There  are  two
       matched  sets  of  material  parameters.  One, the front-facing set, is
       used to shade points, lines, bitmaps, and all polygons (when  two-sided
       lighting  is  disabled),  or just front-facing polygons (when two-sided
       lighting is enabled).  The other set, back-facing,  is  used  to  shade
       back-facing polygons only when two-sided lighting is enabled.  Refer to
       the glLightodel reference page for details concerning  one-  and  two-
       sided lighting calculations.

       glaterial  takes  three arguments.  The first, face, specifies whether
       the   GLFRONT   materials,   the   GLBACK    materials,    or    both
       GLFRONTANDBACK materials will be modified.  The second, pname, spec-
       ifies which of several parameters in one or both sets will be modified.
       The  third,  params, specifies what value or values will be assigned to
       the specified parameter.

       Material parameters are used in the lighting equation that  is  option-
       ally  applied  to  each  vertex.   The  equation  is  discussed  in the
       glLightodel reference page.  The  parameters  that  can  be  specified
       using  glaterial,  and their interpretations by the lighting equation,
       are as follows:

       GLAMBIENT          params contains four integer or floating-point val-
                           ues  that  specify  the ambient RGBA reflectance of
                           the material.  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
                           reflectance for both front- and back-facing materi-
                           als is (0.2, 0.2, 0.2, 1.0).

       GLDIFUSE          params contains four integer or floating-point val-
                           ues that specify the diffuse  RGBA  reflectance  of
                           the  material.   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  diffuse
                           reflectance for both front- and back-facing materi-
                           als is (0.8, 0.8, 0.8, 1.0).

       GLSPECULAR         params contains four integer or floating-point val-
                           ues  that  specify the specular RGBA reflectance of
                           the material.  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 specular
                           reflectance for both front- and back-facing materi-
                           als is (0, 0, 0, 1).

       GLEMISION         params contains four integer or floating-point val-
                           ues that specify the RGBA emitted  light  intensity
                           of  the  material.   Integer values are mapped lin-
                           early such that  the  most  positive  representable
                           value  maps  to  1.0,  and the most negative repre-
                           sentable value maps to -1.0.  Floating-point values
                           are mapped directly.  Neither integer nor floating-
                           point values are  clamped.   The  initial  emission
                           intensity for both front- and back-facing materials
                           is (0, 0, 0, 1).

       GLSHININES        params is a single integer or floating-point  value
                           that  specifies  the  RGBA specular exponent of the
                           material.  Integer and  floating-point  values  are
                           mapped  directly.  Only values in the range [0,128]
                           are accepted.  The initial  specular  exponent  for
                           both front- and back-facing materials is 0.

       GLAMBIENTANDIFUSE
                           Equivalent  to  calling  glaterial  twice with the
                           same parameter values,  once  with  GLAMBIENT  and
                           once with GLDIFUSE.

       GLCOLORINDEXES    params  contains  three  integer  or floating-point
                           values specifying the color  indices  for  ambient,
                           diffuse,  and  specular lighting.  These three val-
                           ues, and GLSHININES, are the only material values
                           used  by  the  color  index mode lighting equation.
                           Refer to the glLightodel reference page for a dis-
                           cussion of color index lighting.

NOTES
       The  material  parameters  can  be updated at any time.  In particular,
       glaterial can be called between a call to glBegin and the  correspond-
       ing  call  to  glEnd.   If  only  a  single material parameter is to be
       changed  per  vertex,  however,  glColoraterial  is   preferred   over
       glaterial (see glColoraterial).

       While  the  ambient, diffuse, specular and emission material parameters
       all have alpha components, only the diffuse alpha component is used  in
       the lighting computation.

ERORS
       GLINVALIDENUM is generated if either face or pname is not an accepted
       value.

       GLINVALIDVALUE is generated if a specular exponent outside the  range
       [0,128] is specified.

ASOCIATED GETS
       glGetaterial

SEE ALSO
       glColoraterial, glLight, glLightodel



                                                                GLMATERIAL(3G)
Darwin Mac OS X man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™