/
glMaterial.xml
353 lines (353 loc) · 16.6 KB
/
glMaterial.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
"http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
<refentry id="glMaterial">
<refmeta>
<refmetainfo>
<copyright>
<year>1991-2006</year>
<holder>Silicon Graphics, Inc.</holder>
</copyright>
</refmetainfo>
<refentrytitle>glMaterial</refentrytitle>
<manvolnum>3G</manvolnum>
</refmeta>
<refnamediv>
<refname>glMaterial</refname>
<refpurpose>specify material parameters for the lighting model</refpurpose>
</refnamediv>
<refsynopsisdiv><title>C Specification</title>
<funcsynopsis>
<funcprototype>
<funcdef>void <function>glMaterialf</function></funcdef>
<paramdef>GLenum <parameter>face</parameter></paramdef>
<paramdef>GLenum <parameter>pname</parameter></paramdef>
<paramdef>GLfloat <parameter>param</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<funcsynopsis>
<funcprototype>
<funcdef>void <function>glMateriali</function></funcdef>
<paramdef>GLenum <parameter>face</parameter></paramdef>
<paramdef>GLenum <parameter>pname</parameter></paramdef>
<paramdef>GLint <parameter>param</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="parameters"><title>Parameters</title>
<variablelist>
<varlistentry>
<term><parameter>face</parameter></term>
<listitem>
<para>
Specifies which face or faces are being updated.
Must be one of
<constant>GL_FRONT</constant>,
<constant>GL_BACK</constant>, or
<constant>GL_FRONT_AND_BACK</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>pname</parameter></term>
<listitem>
<para>
Specifies the single-valued material parameter of the face or faces
that is being updated.
Must be <constant>GL_SHININESS</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>param</parameter></term>
<listitem>
<para>
Specifies the value that parameter <constant>GL_SHININESS</constant> will be set to.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsynopsisdiv><title>C Specification</title>
<funcsynopsis>
<funcprototype>
<funcdef>void <function>glMaterialfv</function></funcdef>
<paramdef>GLenum <parameter>face</parameter></paramdef>
<paramdef>GLenum <parameter>pname</parameter></paramdef>
<paramdef>const GLfloat * <parameter>params</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<funcsynopsis>
<funcprototype>
<funcdef>void <function>glMaterialiv</function></funcdef>
<paramdef>GLenum <parameter>face</parameter></paramdef>
<paramdef>GLenum <parameter>pname</parameter></paramdef>
<paramdef>const GLint * <parameter>params</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="parameters2"><title>Parameters</title>
<variablelist>
<varlistentry>
<term><parameter>face</parameter></term>
<listitem>
<para>
Specifies which face or faces are being updated.
Must be one of
<constant>GL_FRONT</constant>,
<constant>GL_BACK</constant>, or
<constant>GL_FRONT_AND_BACK</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>pname</parameter></term>
<listitem>
<para>
Specifies the material parameter of the face or faces that is being updated.
Must be one of
<constant>GL_AMBIENT</constant>,
<constant>GL_DIFFUSE</constant>,
<constant>GL_SPECULAR</constant>,
<constant>GL_EMISSION</constant>,
<constant>GL_SHININESS</constant>,
<constant>GL_AMBIENT_AND_DIFFUSE</constant>, or
<constant>GL_COLOR_INDEXES</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>params</parameter></term>
<listitem>
<para>
Specifies a pointer to the value or values that <parameter>pname</parameter> will be set to.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="description"><title>Description</title>
<para>
<function>glMaterial</function> assigns values to material parameters.
There are two matched sets of material parameters.
One,
the <emphasis>front-facing</emphasis> 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,
<emphasis>back-facing</emphasis>,
is used to shade back-facing polygons only when two-sided lighting is enabled.
Refer to the <citerefentry><refentrytitle>glLightModel</refentrytitle></citerefentry> reference page for details concerning one- and
two-sided lighting calculations.
</para>
<para>
<function>glMaterial</function> takes three arguments.
The first,
<parameter>face</parameter>,
specifies whether the
<constant>GL_FRONT</constant> materials, the
<constant>GL_BACK</constant> materials, or both
<constant>GL_FRONT_AND_BACK</constant> materials will be modified.
The second,
<parameter>pname</parameter>,
specifies which of several parameters in one or both sets will be modified.
The third,
<parameter>params</parameter>,
specifies what value or values will be assigned to the specified parameter.
</para>
<para>
Material parameters are used in the lighting equation that is optionally
applied to each vertex.
The equation is discussed in the <citerefentry><refentrytitle>glLightModel</refentrytitle></citerefentry> reference page.
The parameters that can be specified using <function>glMaterial</function>,
and their interpretations by the lighting equation, are as follows:
</para>
<variablelist>
<varlistentry>
<term><constant>GL_AMBIENT</constant></term>
<listitem>
<para>
<parameter>params</parameter> 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
<inlineequation><mml:math>
<!-- eqn: -1.0:-->
<mml:mn>-1.0</mml:mn>
</mml:math></inlineequation>.
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).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_DIFFUSE</constant></term>
<listitem>
<para>
<parameter>params</parameter> 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
<inlineequation><mml:math>
<!-- eqn: -1.0:-->
<mml:mn>-1.0</mml:mn>
</mml:math></inlineequation>.
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).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_SPECULAR</constant></term>
<listitem>
<para>
<parameter>params</parameter> 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
<inlineequation><mml:math>
<!-- eqn: -1.0:-->
<mml:mn>-1.0</mml:mn>
</mml:math></inlineequation>.
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).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_EMISSION</constant></term>
<listitem>
<para>
<parameter>params</parameter> 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
<inlineequation><mml:math>
<!-- eqn: -1.0:-->
<mml:mn>-1.0</mml:mn>
</mml:math></inlineequation>.
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).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_SHININESS</constant></term>
<listitem>
<para>
<parameter>params</parameter> 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
<inlineequation><mml:math>
<!-- eqn: [0,128]:-->
<mml:mfenced open="[" close="]">
<mml:mn>0</mml:mn>
<mml:mn>128</mml:mn>
</mml:mfenced>
</mml:math></inlineequation>
are accepted.
The initial specular exponent for both front- and back-facing materials
is 0.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_AMBIENT_AND_DIFFUSE</constant></term>
<listitem>
<para>
Equivalent to calling <function>glMaterial</function> twice with the same parameter values,
once with <constant>GL_AMBIENT</constant> and once with <constant>GL_DIFFUSE</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GL_COLOR_INDEXES</constant></term>
<listitem>
<para>
<parameter>params</parameter> contains three integer or floating-point values specifying
the color indices for ambient,
diffuse,
and specular lighting.
These three values,
and <constant>GL_SHININESS</constant>,
are the only material values used by the color index mode lighting equation.
Refer to the <citerefentry><refentrytitle>glLightModel</refentrytitle></citerefentry> reference page for a discussion
of color index lighting.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="notes"><title>Notes</title>
<para>
The material parameters can be updated at any time.
In particular,
<function>glMaterial</function> can be called between a call to <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the corresponding
call to <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.
If only a single material parameter is to be changed per vertex,
however,
<citerefentry><refentrytitle>glColorMaterial</refentrytitle></citerefentry> is preferred over <function>glMaterial</function>
(see <citerefentry><refentrytitle>glColorMaterial</refentrytitle></citerefentry>).
</para>
<para>
While the ambient, diffuse, specular and emission material parameters
all have alpha components, only the diffuse alpha component is used in
the lighting computation.
</para>
</refsect1>
<refsect1 id="errors"><title>Errors</title>
<para>
<constant>GL_INVALID_ENUM</constant> is generated if either <parameter>face</parameter> or <parameter>pname</parameter> is not
an accepted value.
</para>
<para>
<constant>GL_INVALID_VALUE</constant> is generated if a specular exponent outside the range
<inlineequation><mml:math>
<!-- eqn: [0,128]:-->
<mml:mfenced open="[" close="]">
<mml:mn>0</mml:mn>
<mml:mn>128</mml:mn>
</mml:mfenced>
</mml:math></inlineequation>
is specified.
</para>
</refsect1>
<refsect1 id="associatedgets"><title>Associated Gets</title>
<para>
<citerefentry><refentrytitle>glGetMaterial</refentrytitle></citerefentry>
</para>
</refsect1>
<refsect1 id="seealso"><title>See Also</title>
<para>
<citerefentry><refentrytitle>glColorMaterial</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glLight</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glLightModel</refentrytitle></citerefentry>
</para>
</refsect1>
<refsect1 id="Copyright"><title>Copyright</title>
<para>
Copyright <trademark class="copyright"></trademark> 1991-2006
Silicon Graphics, Inc. This document is licensed under the SGI
Free Software B License. For details, see
<ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
</para>
</refsect1>
</refentry>