1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id=
"glMaterial">
9 <holder>Silicon Graphics, Inc.
</holder>
12 <refentrytitle>glMaterial
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>glMaterial
</refname>
17 <refpurpose>specify material parameters for the lighting model
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>void
<function>glMaterialf
</function></funcdef>
23 <paramdef>GLenum
<parameter>face
</parameter></paramdef>
24 <paramdef>GLenum
<parameter>pname
</parameter></paramdef>
25 <paramdef>GLfloat
<parameter>param
</parameter></paramdef>
30 <funcdef>void
<function>glMateriali
</function></funcdef>
31 <paramdef>GLenum
<parameter>face
</parameter></paramdef>
32 <paramdef>GLenum
<parameter>pname
</parameter></paramdef>
33 <paramdef>GLint
<parameter>param
</parameter></paramdef>
37 <refsect1 id=
"parameters"><title>Parameters
</title>
40 <term><parameter>face
</parameter></term>
43 Specifies which face or faces are being updated.
45 <constant>GL_FRONT
</constant>,
46 <constant>GL_BACK
</constant>, or
47 <constant>GL_FRONT_AND_BACK
</constant>.
52 <term><parameter>pname
</parameter></term>
55 Specifies the single-valued material parameter of the face or faces
56 that is being updated.
57 Must be
<constant>GL_SHININESS
</constant>.
62 <term><parameter>param
</parameter></term>
65 Specifies the value that parameter
<constant>GL_SHININESS
</constant> will be set to.
71 <refsynopsisdiv><title>C Specification
</title>
74 <funcdef>void
<function>glMaterialfv
</function></funcdef>
75 <paramdef>GLenum
<parameter>face
</parameter></paramdef>
76 <paramdef>GLenum
<parameter>pname
</parameter></paramdef>
77 <paramdef>const GLfloat *
<parameter>params
</parameter></paramdef>
82 <funcdef>void
<function>glMaterialiv
</function></funcdef>
83 <paramdef>GLenum
<parameter>face
</parameter></paramdef>
84 <paramdef>GLenum
<parameter>pname
</parameter></paramdef>
85 <paramdef>const GLint *
<parameter>params
</parameter></paramdef>
89 <refsect1 id=
"parameters2"><title>Parameters
</title>
92 <term><parameter>face
</parameter></term>
95 Specifies which face or faces are being updated.
97 <constant>GL_FRONT
</constant>,
98 <constant>GL_BACK
</constant>, or
99 <constant>GL_FRONT_AND_BACK
</constant>.
104 <term><parameter>pname
</parameter></term>
107 Specifies the material parameter of the face or faces that is being updated.
109 <constant>GL_AMBIENT
</constant>,
110 <constant>GL_DIFFUSE
</constant>,
111 <constant>GL_SPECULAR
</constant>,
112 <constant>GL_EMISSION
</constant>,
113 <constant>GL_SHININESS
</constant>,
114 <constant>GL_AMBIENT_AND_DIFFUSE
</constant>, or
115 <constant>GL_COLOR_INDEXES
</constant>.
120 <term><parameter>params
</parameter></term>
123 Specifies a pointer to the value or values that
<parameter>pname
</parameter> will be set to.
129 <refsect1 id=
"description"><title>Description
</title>
131 <function>glMaterial
</function> assigns values to material parameters.
132 There are two matched sets of material parameters.
134 the
<emphasis>front-facing
</emphasis> set,
135 is used to shade points,
139 (when two-sided lighting is disabled),
140 or just front-facing polygons
141 (when two-sided lighting is enabled).
143 <emphasis>back-facing
</emphasis>,
144 is used to shade back-facing polygons only when two-sided lighting is enabled.
145 Refer to the
<citerefentry><refentrytitle>glLightModel
</refentrytitle></citerefentry> reference page for details concerning one- and
146 two-sided lighting calculations.
149 <function>glMaterial
</function> takes three arguments.
151 <parameter>face
</parameter>,
152 specifies whether the
153 <constant>GL_FRONT
</constant> materials, the
154 <constant>GL_BACK
</constant> materials, or both
155 <constant>GL_FRONT_AND_BACK
</constant> materials will be modified.
157 <parameter>pname
</parameter>,
158 specifies which of several parameters in one or both sets will be modified.
160 <parameter>params
</parameter>,
161 specifies what value or values will be assigned to the specified parameter.
164 Material parameters are used in the lighting equation that is optionally
165 applied to each vertex.
166 The equation is discussed in the
<citerefentry><refentrytitle>glLightModel
</refentrytitle></citerefentry> reference page.
167 The parameters that can be specified using
<function>glMaterial
</function>,
168 and their interpretations by the lighting equation, are as follows:
172 <term><constant>GL_AMBIENT
</constant></term>
175 <parameter>params
</parameter> contains four integer or floating-point values that specify
176 the ambient RGBA reflectance of the material.
177 Integer values are mapped linearly such that the most positive representable
179 and the most negative representable value maps to
180 <inlineequation><mml:math>
182 <mml:mn>-
1.0</mml:mn>
183 </mml:math></inlineequation>.
184 Floating-point values are mapped directly.
185 Neither integer nor floating-point values are clamped.
186 The initial ambient reflectance for both front- and back-facing materials
187 is (
0.2,
0.2,
0.2,
1.0).
192 <term><constant>GL_DIFFUSE
</constant></term>
195 <parameter>params
</parameter> contains four integer or floating-point values that specify
196 the diffuse RGBA reflectance of the material.
197 Integer values are mapped linearly such that the most positive representable
199 and the most negative representable value maps to
200 <inlineequation><mml:math>
202 <mml:mn>-
1.0</mml:mn>
203 </mml:math></inlineequation>.
204 Floating-point values are mapped directly.
205 Neither integer nor floating-point values are clamped.
206 The initial diffuse reflectance for both front- and back-facing materials
207 is (
0.8,
0.8,
0.8,
1.0).
212 <term><constant>GL_SPECULAR
</constant></term>
215 <parameter>params
</parameter> contains four integer or floating-point values that specify
216 the specular RGBA reflectance of the material.
217 Integer values are mapped linearly such that the most positive representable
219 and the most negative representable value maps to
220 <inlineequation><mml:math>
222 <mml:mn>-
1.0</mml:mn>
223 </mml:math></inlineequation>.
224 Floating-point values are mapped directly.
225 Neither integer nor floating-point values are clamped.
226 The initial specular reflectance for both front- and back-facing materials
232 <term><constant>GL_EMISSION
</constant></term>
235 <parameter>params
</parameter> contains four integer or floating-point values that specify
236 the RGBA emitted light intensity of the material.
237 Integer values are mapped linearly such that the most positive representable
239 and the most negative representable value maps to
240 <inlineequation><mml:math>
242 <mml:mn>-
1.0</mml:mn>
243 </mml:math></inlineequation>.
244 Floating-point values are mapped directly.
245 Neither integer nor floating-point values are clamped.
246 The initial emission intensity for both front- and back-facing materials
252 <term><constant>GL_SHININESS
</constant></term>
255 <parameter>params
</parameter> is a single integer or floating-point value that specifies
256 the RGBA specular exponent of the material.
257 Integer and floating-point values are mapped directly.
258 Only values in the range
259 <inlineequation><mml:math>
260 <!-- eqn: [0,128]:-->
261 <mml:mfenced open=
"[" close=
"]">
265 </mml:math></inlineequation>
267 The initial specular exponent for both front- and back-facing materials
273 <term><constant>GL_AMBIENT_AND_DIFFUSE
</constant></term>
276 Equivalent to calling
<function>glMaterial
</function> twice with the same parameter values,
277 once with
<constant>GL_AMBIENT
</constant> and once with
<constant>GL_DIFFUSE
</constant>.
282 <term><constant>GL_COLOR_INDEXES
</constant></term>
285 <parameter>params
</parameter> contains three integer or floating-point values specifying
286 the color indices for ambient,
288 and specular lighting.
290 and
<constant>GL_SHININESS
</constant>,
291 are the only material values used by the color index mode lighting equation.
292 Refer to the
<citerefentry><refentrytitle>glLightModel
</refentrytitle></citerefentry> reference page for a discussion
293 of color index lighting.
299 <refsect1 id=
"notes"><title>Notes
</title>
301 The material parameters can be updated at any time.
303 <function>glMaterial
</function> can be called between a call to
<citerefentry><refentrytitle>glBegin
</refentrytitle></citerefentry> and the corresponding
304 call to
<citerefentry><refentrytitle>glEnd
</refentrytitle></citerefentry>.
305 If only a single material parameter is to be changed per vertex,
307 <citerefentry><refentrytitle>glColorMaterial
</refentrytitle></citerefentry> is preferred over
<function>glMaterial
</function>
308 (see
<citerefentry><refentrytitle>glColorMaterial
</refentrytitle></citerefentry>).
311 While the ambient, diffuse, specular and emission material parameters
312 all have alpha components, only the diffuse alpha component is used in
313 the lighting computation.
316 <refsect1 id=
"errors"><title>Errors
</title>
318 <constant>GL_INVALID_ENUM
</constant> is generated if either
<parameter>face
</parameter> or
<parameter>pname
</parameter> is not
322 <constant>GL_INVALID_VALUE
</constant> is generated if a specular exponent outside the range
323 <inlineequation><mml:math>
324 <!-- eqn: [0,128]:-->
325 <mml:mfenced open=
"[" close=
"]">
329 </mml:math></inlineequation>
333 <refsect1 id=
"associatedgets"><title>Associated Gets
</title>
335 <citerefentry><refentrytitle>glGetMaterial
</refentrytitle></citerefentry>
338 <refsect1 id=
"seealso"><title>See Also
</title>
340 <citerefentry><refentrytitle>glColorMaterial
</refentrytitle></citerefentry>,
341 <citerefentry><refentrytitle>glLight
</refentrytitle></citerefentry>,
342 <citerefentry><refentrytitle>glLightModel
</refentrytitle></citerefentry>
345 <refsect1 id=
"Copyright"><title>Copyright
</title>
347 Copyright
<trademark class=
"copyright"></trademark> 1991-
2006
348 Silicon Graphics, Inc. This document is licensed under the SGI
349 Free Software B License. For details, see
350 <ulink url=
"http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/
</ulink>.