GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


Manpage of GLMATERIAL

GLMATERIAL

Index
 

NAME

glMaterialf, glMateriali, glMaterialfv, glMaterialiv - specify material parameters for the lighting model

 

C SPECIFICATION

void f3glMaterialffP( GLenum fIfacefP,
   GLenum fIpnamefP,
   GLint fIparamfP )

 

PARAMETERS

f2facefP
Specifies which face or faces are being updated. Must be one of %f3GL_FRONTfP, %f3GL_BACKfP, or %f3GL_FRONT_AND_BACKfP.
f2pnamefP
Specifies the single-valued material parameter of the face or faces that is being updated. Must be %f3GL_SHININESSfP.
f2paramfP
Specifies the value that parameter %f3GL_SHININESSfP will be set to.
 

C SPECIFICATION

void f3glMaterialfvfP( GLenum fIfacefP,
   GLenum fIpnamefP,
   const GLint fI*paramsfP )

 

PARAMETERS

f2facefP
Specifies which face or faces are being updated. Must be one of %f3GL_FRONTfP, %f3GL_BACKfP, or %f3GL_FRONT_AND_BACKfP.
f2pnamefP
Specifies the material parameter of the face or faces that is being updated. Must be one of %f3GL_AMBIENTfP, %f3GL_DIFFUSEfP, %f3GL_SPECULARfP, %f3GL_EMISSIONfP, %f3GL_SHININESSfP, %f3GL_AMBIENT_AND_DIFFUSEfP, or %f3GL_COLOR_INDEXESfP.
f2paramsfP
Specifies a pointer to the value or values that f2pnamefP will be set to.
 

DESCRIPTION

%f3glMaterialfP assigns values to material parameters. There are two matched sets of material parameters. One, the f2front-facingfP 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, f2back-facingfP, is used to shade back-facing polygons only when two-sided lighting is enabled. Refer to the %f3glLightModelfP reference page for details concerning one- and two-sided lighting calculations. %f3glMaterialfP takes three arguments. The first, f2facefP, specifies whether the %f3GL_FRONTfP materials, the %f3GL_BACKfP materials, or both %f3GL_FRONT_AND_BACKfP materials will be modified. The second, f2pnamefP, specifies which of several parameters in one or both sets will be modified. The third, f2paramsfP, specifies what value or values will be assigned to the specified parameter. Material parameters are used in the lighting equation that is optionally applied to each vertex. The equation is discussed in the %f3glLightModelfP reference page. The parameters that can be specified using %f3glMaterialfP, and their interpretations by the lighting equation, are as follows:
%f3GL_AMBIENTfP
f2paramsfP contains four integer or floating-point values 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 materials is (0.2, 0.2, 0.2, 1.0).
%f3GL_DIFFUSEfP
f2paramsfP contains four integer or floating-point values 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 materials is (0.8, 0.8, 0.8, 1.0).
%f3GL_SPECULARfP
f2paramsfP contains four integer or floating-point values 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 materials is (0, 0, 0, 1).
%f3GL_EMISSIONfP
f2paramsfP contains four integer or floating-point values that specify the RGBA emitted light intensity 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 emission intensity for both front- and back-facing materials is (0, 0, 0, 1).
%f3GL_SHININESSfP
f2paramsfP 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.
%f3GL_AMBIENT_AND_DIFFUSEfP
Equivalent to calling %f3glMaterialfP twice with the same parameter values, once with %f3GL_AMBIENTfP and once with %f3GL_DIFFUSEfP.
%f3GL_COLOR_INDEXESfP
f2paramsfP contains three integer or floating-point values specifying the color indices for ambient, diffuse, and specular lighting. These three values, and %f3GL_SHININESSfP, are the only material values used by the color index mode lighting equation. Refer to the %f3glLightModelfP reference page for a discussion of color index lighting.
 

NOTES

The material parameters can be updated at any time. In particular, %f3glMaterialfP can be called between a call to %f3glBeginfP and the corresponding call to %f3glEndfP. If only a single material parameter is to be changed per vertex, however, %f3glColorMaterialfP is preferred over %f3glMaterialfP (see %f3glColorMaterialfP). While the ambient, diffuse, specular and emission material parameters all have alpha components, only the diffuse alpha component is used in the lighting computation.  

ERRORS

%f3GL_INVALID_ENUMfP is generated if either f2facefP or f2pnamefP is not an accepted value. %f3GL_INVALID_VALUEfP is generated if a specular exponent outside the range [0,128] is specified.  

ASSOCIATED GETS

%f3glGetMaterialfP  

SEE ALSO

%f3glColorMaterial(3G)fP, %f3glLight(3G)fP, %f3glLightModel(3G)fP


 

Index

NAME
C SPECIFICATION
PARAMETERS
C SPECIFICATION
PARAMETERS
DESCRIPTION
NOTES
ERRORS
ASSOCIATED GETS
SEE ALSO