NAME

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

C SPECIFICATION

void ggllMMaatteerriiaallff( GLenum _f_a_c_e,
                  GLenum _p_n_a_m_e,
                  GLfloat _p_a_r_a_m )
void ggllMMaatteerriiaallii( GLenum _f_a_c_e,
                  GLenum _p_n_a_m_e,
                  GLint _p_a_r_a_m )

PARAMETERS

_f_a_c_e
Specifies which face or faces are being updated. Must be one of GGLL__FFRROONNTT, GGLL__BBAACCKK, or GGLL__FFRROONNTT__AANNDD__BBAACCKK.
_p_n_a_m_e
Specifies the single-valued material parameter of the face or faces that is being updated. Must be GGLL__SSHHIINNIINNEESSSS.
_p_a_r_a_m
Specifies the value that parameter GGLL__SSHHIINNIINNEESSSS will be set to.

C SPECIFICATION

void ggllMMaatteerriiaallffvv( GLenum _f_a_c_e,
                   GLenum _p_n_a_m_e,
                   const GLfloat _*_p_a_r_a_m_s )
void ggllMMaatteerriiaalliivv( GLenum _f_a_c_e,
                   GLenum _p_n_a_m_e,
                   const GLint _*_p_a_r_a_m_s )

PARAMETERS

_f_a_c_e
Specifies which face or faces are being updated. Must be one of GGLL__FFRROONNTT, GGLL__BBAACCKK, or GGLL__FFRROONNTT__AANNDD__BBAACCKK.
_p_n_a_m_e
Specifies the material parameter of the face or faces that is being updated. Must be one of GGLL__AAMMBBIIEENNTT, GGLL__DDIIFFFFUUSSEE, GGLL__SSPPEECCUULLAARR, GGLL__EEMMIISSSSIIOONN, GGLL__SSHHIINNIINNEESSSS, GGLL__AAMMBBIIEENNTT__AANNDD__DDIIFFFFUUSSEE, or GGLL__CCOOLLOORR__IINNDDEEXXEESS.
_p_a_r_a_m_s
Specifies a pointer to the value or values that _p_n_a_m_e will be set to.

DESCRIPTION

ggllMMaatteerriiaall assigns values to material parameters. There are two matched sets of material parameters. One, the _f_r_o_n_t_-_f_a_c_i_n_g 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, _b_a_c_k_-_f_a_c_i_n_g, is used to shade back-facing polygons only when two-sided lighting is enabled. Refer to the ggllLLiigghhttMMooddeell reference page for details concerning one- and two-sided lighting calculations.

ggllMMaatteerriiaall takes three arguments. The first, _f_a_c_e, specifies whether the GGLL__FFRROONNTT materials, the GGLL__BBAACCKK materials, or both GGLL__FFRROONNTT__AANNDD__BBAACCKK materials will be modified. The second, _p_n_a_m_e, specifies which of several parameters in one or both sets will be modified. The third, _p_a_r_a_m_s, 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 ggllLLiigghhttMMooddeell reference page. The parameters that can be specified using ggllMMaatteerriiaall, and their interpretations by the lighting equation, are as follows:

GGLL__AAMMBBIIEENNTT
_p_a_r_a_m_s 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).
GGLL__DDIIFFFFUUSSEE
_p_a_r_a_m_s 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).
GGLL__SSPPEECCUULLAARR
_p_a_r_a_m_s 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).
GGLL__EEMMIISSSSIIOONN
_p_a_r_a_m_s 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).
GGLL__SSHHIINNIINNEESSSS
_p_a_r_a_m_s 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.
GGLL__AAMMBBIIEENNTT__AANNDD__DDIIFFFFUUSSEE
Equivalent to calling ggllMMaatteerriiaall twice with the same parameter values, once with GGLL__AAMMBBIIEENNTT and once with GGLL__DDIIFFFFUUSSEE.
GGLL__CCOOLLOORR__IINNDDEEXXEESS
_p_a_r_a_m_s contains three integer or floating-point values specifying the color indices for ambient, diffuse, and specular lighting. These three values, and GGLL__SSHHIINNIINNEESSSS, are the only material values used by the color index mode lighting equation. Refer to the ggllLLiigghhttMMooddeell reference page for a discussion of color index lighting.

NOTES

The material parameters can be updated at any time. In particular, ggllMMaatteerriiaall can be called between a call to ggllBBeeggiinn and the corresponding call to ggllEEnndd. If only a single material parameter is to be changed per vertex, however, ggllCCoolloorrMMaatteerriiaall is preferred over ggllMMaatteerriiaall (see ggllCCoolloorrMMaatteerriiaall).

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

GGLL__IINNVVAALLIIDD__EENNUUMM is generated if either _f_a_c_e or _p_n_a_m_e is not an accepted value.

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

ASSOCIATED GETS

ggllGGeettMMaatteerriiaall

SEE ALSO

ggllCCoolloorrMMaatteerriiaall((33GG)), ggllLLiigghhtt((33GG)), ggllLLiigghhttMMooddeell((33GG))