Subversion Repositories AndroidProjects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1452 chris 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">
5
    <refmeta>
6
        <refmetainfo>
7
            <copyright>
8
                <year>1991-2006</year>
9
                <holder>Silicon Graphics, Inc.</holder>
10
            </copyright>
11
        </refmetainfo>
12
        <refentrytitle>glMaterial</refentrytitle>
13
        <manvolnum>3G</manvolnum>
14
    </refmeta>
15
    <refnamediv>
16
        <refname>glMaterial</refname>
17
        <refpurpose>specify material parameters for the lighting model</refpurpose>
18
    </refnamediv>
19
    <refsynopsisdiv><title>C Specification</title>
20
        <funcsynopsis>
21
            <funcprototype>
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>
26
            </funcprototype>
27
        </funcsynopsis>
28
        <funcsynopsis>
29
            <funcprototype>
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>
34
            </funcprototype>
35
        </funcsynopsis>
36
    </refsynopsisdiv>
37
    <refsect1 id="parameters"><title>Parameters</title>
38
        <variablelist>
39
        <varlistentry>
40
            <term><parameter>face</parameter></term>
41
            <listitem>
42
                <para>
43
                    Specifies which face or faces are being updated.
44
                    Must be one of
45
                    <constant>GL_FRONT</constant>,
46
                    <constant>GL_BACK</constant>, or
47
                    <constant>GL_FRONT_AND_BACK</constant>.
48
                </para>
49
            </listitem>
50
        </varlistentry>
51
        <varlistentry>
52
            <term><parameter>pname</parameter></term>
53
            <listitem>
54
                <para>
55
                    Specifies the single-valued material parameter of the face or faces
56
                    that is being updated.
57
                    Must be <constant>GL_SHININESS</constant>.
58
                </para>
59
            </listitem>
60
        </varlistentry>
61
        <varlistentry>
62
            <term><parameter>param</parameter></term>
63
            <listitem>
64
                <para>
65
                    Specifies the value that parameter <constant>GL_SHININESS</constant> will be set to.
66
                </para>
67
            </listitem>
68
        </varlistentry>
69
        </variablelist>
70
    </refsect1>
71
    <refsynopsisdiv><title>C Specification</title>
72
        <funcsynopsis>
73
            <funcprototype>
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>
78
            </funcprototype>
79
        </funcsynopsis>
80
        <funcsynopsis>
81
            <funcprototype>
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>
86
            </funcprototype>
87
        </funcsynopsis>
88
    </refsynopsisdiv>
89
    <refsect1 id="parameters2"><title>Parameters</title>
90
        <variablelist>
91
        <varlistentry>
92
            <term><parameter>face</parameter></term>
93
            <listitem>
94
                <para>
95
                    Specifies which face or faces are being updated.
96
                    Must be one of
97
                    <constant>GL_FRONT</constant>,
98
                    <constant>GL_BACK</constant>, or
99
                    <constant>GL_FRONT_AND_BACK</constant>.
100
                </para>
101
            </listitem>
102
        </varlistentry>
103
        <varlistentry>
104
            <term><parameter>pname</parameter></term>
105
            <listitem>
106
                <para>
107
                    Specifies the material parameter of the face or faces that is being updated.
108
                    Must be one of
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>.
116
                </para>
117
            </listitem>
118
        </varlistentry>
119
        <varlistentry>
120
            <term><parameter>params</parameter></term>
121
            <listitem>
122
                <para>
123
                    Specifies a pointer to the value or values that <parameter>pname</parameter> will be set to.
124
                </para>
125
            </listitem>
126
        </varlistentry>
127
        </variablelist>
128
    </refsect1>
129
    <refsect1 id="description"><title>Description</title>
130
        <para>
131
            <function>glMaterial</function> assigns values to material parameters.
132
            There are two matched sets of material parameters.
133
            One,
134
            the <emphasis>front-facing</emphasis> set,
135
            is used to shade points,
136
            lines,
137
            bitmaps,
138
            and all polygons
139
            (when two-sided lighting is disabled),
140
            or just front-facing polygons
141
            (when two-sided lighting is enabled).
142
            The other set,
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.
147
        </para>
148
        <para>
149
            <function>glMaterial</function> takes three arguments.
150
            The first,
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.
156
            The second,
157
            <parameter>pname</parameter>,
158
            specifies which of several parameters in one or both sets will be modified.
159
            The third,
160
            <parameter>params</parameter>,
161
            specifies what value or values will be assigned to the specified parameter.
162
        </para>
163
        <para>
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:
169
        </para>
170
        <variablelist>
171
            <varlistentry>
172
                <term><constant>GL_AMBIENT</constant></term>
173
                <listitem>
174
                    <para>
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
178
                        value maps to 1.0,
179
                        and the most negative representable value maps to
180
                        <inlineequation><mml:math>
181
                            <!-- eqn: -1.0:-->
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).
188
                    </para>
189
                </listitem>
190
            </varlistentry>
191
            <varlistentry>
192
                <term><constant>GL_DIFFUSE</constant></term>
193
                <listitem>
194
                    <para>
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
198
                        value maps to 1.0,
199
                        and the most negative representable value maps to
200
                        <inlineequation><mml:math>
201
                            <!-- eqn: -1.0:-->
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).
208
                    </para>
209
                </listitem>
210
            </varlistentry>
211
            <varlistentry>
212
                <term><constant>GL_SPECULAR</constant></term>
213
                <listitem>
214
                    <para>
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
218
                        value maps to 1.0,
219
                        and the most negative representable value maps to
220
                        <inlineequation><mml:math>
221
                            <!-- eqn: -1.0:-->
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
227
                        is (0, 0, 0, 1).
228
                    </para>
229
                </listitem>
230
            </varlistentry>
231
            <varlistentry>
232
                <term><constant>GL_EMISSION</constant></term>
233
                <listitem>
234
                    <para>
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
238
                        value maps to 1.0,
239
                        and the most negative representable value maps to
240
                        <inlineequation><mml:math>
241
                            <!-- eqn: -1.0:-->
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
247
                        is (0, 0, 0, 1).
248
                    </para>
249
                </listitem>
250
            </varlistentry>
251
            <varlistentry>
252
                <term><constant>GL_SHININESS</constant></term>
253
                <listitem>
254
                    <para>
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="]">
262
                                <mml:mn>0</mml:mn>
263
                                <mml:mn>128</mml:mn>
264
                            </mml:mfenced>
265
                        </mml:math></inlineequation>
266
                        are accepted.
267
                        The initial specular exponent for both front- and back-facing materials
268
                        is 0.
269
                    </para>
270
                </listitem>
271
            </varlistentry>
272
            <varlistentry>
273
                <term><constant>GL_AMBIENT_AND_DIFFUSE</constant></term>
274
                <listitem>
275
                    <para>
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>.
278
                    </para>
279
                </listitem>
280
            </varlistentry>
281
            <varlistentry>
282
                <term><constant>GL_COLOR_INDEXES</constant></term>
283
                <listitem>
284
                    <para>
285
                        <parameter>params</parameter> contains three integer or floating-point values specifying
286
                        the color indices for ambient,
287
                        diffuse,
288
                        and specular lighting.
289
                        These three values,
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.
294
                    </para>
295
                </listitem>
296
            </varlistentry>
297
        </variablelist>
298
    </refsect1>
299
    <refsect1 id="notes"><title>Notes</title>
300
        <para>
301
            The material parameters can be updated at any time.
302
            In particular,
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,
306
            however,
307
            <citerefentry><refentrytitle>glColorMaterial</refentrytitle></citerefentry> is preferred over <function>glMaterial</function>
308
            (see <citerefentry><refentrytitle>glColorMaterial</refentrytitle></citerefentry>).
309
        </para>
310
        <para>
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.
314
        </para>
315
    </refsect1>
316
    <refsect1 id="errors"><title>Errors</title>
317
        <para>
318
            <constant>GL_INVALID_ENUM</constant> is generated if either <parameter>face</parameter> or <parameter>pname</parameter> is not
319
            an accepted value.
320
        </para>
321
        <para>
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="]">
326
                    <mml:mn>0</mml:mn>
327
                    <mml:mn>128</mml:mn>
328
                </mml:mfenced>
329
            </mml:math></inlineequation>
330
            is specified.
331
        </para>
332
    </refsect1>
333
    <refsect1 id="associatedgets"><title>Associated Gets</title>
334
        <para>
335
            <citerefentry><refentrytitle>glGetMaterial</refentrytitle></citerefentry>
336
        </para>
337
    </refsect1>
338
    <refsect1 id="seealso"><title>See Also</title>
339
        <para>
340
            <citerefentry><refentrytitle>glColorMaterial</refentrytitle></citerefentry>,
341
            <citerefentry><refentrytitle>glLight</refentrytitle></citerefentry>,
342
            <citerefentry><refentrytitle>glLightModel</refentrytitle></citerefentry>
343
        </para>
344
    </refsect1>
345
    <refsect1 id="Copyright"><title>Copyright</title>
346
        <para>
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>.
351
        </para>
352
    </refsect1>
353
</refentry>