forked from BSVino/docs.gl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
glMaterial.xhtml
128 lines (127 loc) · 11.6 KB
/
glMaterial.xhtml
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
<div class="refentry" title="glMaterial"><a id="glMaterial"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glMaterial — specify material parameters for the lighting model</p></div><div class="refsynopsisdiv" title="C Specification"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">glMaterialf</b>(</code></td><td>GLenum <var class="pdparam">face</var>, </td></tr><tr><td> </td><td>GLenum <var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>GLfloat <var class="pdparam">param</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">glMaterialx</b>(</code></td><td>GLenum <var class="pdparam">face</var>, </td></tr><tr><td> </td><td>GLenum <var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>GLfixed <var class="pdparam">param</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Parameters"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term">
<em class="parameter"><code>face</code></em>
</span></dt><dd><p>Specifies which face or faces are being updated. Must be
<code class="constant">GL_FRONT_AND_BACK</code>.</p></dd><dt><span class="term">
<em class="parameter"><code>pname</code></em>
</span></dt><dd><p>Specifies the single-valued material parameter of
the face or faces that is being updated. Must be
<code class="constant">GL_SHININESS</code>.</p></dd><dt><span class="term">
<em class="parameter"><code>param</code></em>
</span></dt><dd><p>Specifies the value that parameter
<code class="constant">GL_SHININESS</code> will be set to.</p></dd></dl></div></div><div class="refsynopsisdiv" title="C Specification"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">glMaterialfv</b>(</code></td><td>GLenum <var class="pdparam">face</var>, </td></tr><tr><td> </td><td>GLenum <var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>const GLfloat * <var class="pdparam">params</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">glMaterialxv</b>(</code></td><td>GLenum <var class="pdparam">face</var>, </td></tr><tr><td> </td><td>GLenum <var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>const GLfixed * <var class="pdparam">params</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Parameters"><a id="parameters2"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term">
<em class="parameter"><code>face</code></em>
</span></dt><dd><p>Specifies which face or faces are being updated.
Must be <code class="constant">GL_FRONT_AND_BACK</code>.
</p></dd><dt><span class="term">
<em class="parameter"><code>pname</code></em>
</span></dt><dd><p>Specifies the material parameter of the face or
faces that is being updated. Must be one of
<code class="constant">GL_AMBIENT</code>,
<code class="constant">GL_DIFFUSE</code>,
<code class="constant">GL_SPECULAR</code>,
<code class="constant">GL_EMISSION</code>,
<code class="constant">GL_SHININESS</code>, or
<code class="constant">GL_AMBIENT_AND_DIFFUSE</code>.</p></dd><dt><span class="term">
<em class="parameter"><code>params</code></em>
</span></dt><dd><p>Specifies a pointer to the value or values that
<em class="parameter"><code>pname</code></em>
will be set to.</p></dd></dl></div></div><div class="refsect1" title="Description"><a id="description"></a><h2>Description</h2><p>
<code class="function">glMaterial</code>
assigns values to material parameters. There are two matched
sets of material parameters. One, the <em class="parameter"><code>front-facing</code></em>
set, is used to shade points, lines, and all polygons (when
two-sided lighting is disabled), or just front-facing polygons
(when two-sided lighting is enabled). The other set,
<em class="parameter"><code>back-facing</code></em>,
is used to shade back-facing polygons only when two-sided
lighting is enabled. Refer to the
<a class="citerefentry" href="glLightModel"><span class="citerefentry"><span class="refentrytitle">glLightModel</span></span></a>
reference page for details concerning one- and two-sided
lighting calculations.
</p><p>
<code class="function">glMaterial</code>
takes three arguments. The first, <em class="parameter"><code>face</code></em>,
must be <code class="constant">GL_FRONT_AND_BACK</code> and specifies that both
front and back materials will be modified.
The second, <em class="parameter"><code>pname</code></em>,
specifies which of several parameters in one or both sets
will be modified. The third, <em class="parameter"><code>params</code></em>,
specifies what value or values will be assigned to the
specified parameter.
</p><p>
Material parameters are used in the lighting equation
that is optionally applied to each vertex. The equation is
discussed in the
<a class="citerefentry" href="glLightModel"><span class="citerefentry"><span class="refentrytitle">glLightModel</span></span></a>
reference page. The parameters that can be specified using
<code class="function">glMaterial</code>,
and their interpretations by the lighting equation, are as follows:
</p><div class="variablelist"><dl><dt><span class="term">
<code class="constant">GL_AMBIENT</code>
</span></dt><dd><p><em class="parameter"><code>params</code></em>
contains four fixed-point or floating-point values that
specify the ambient RGBA reflectance of the material.
The values are not clamped. The initial ambient
reflectance is
(0.2, 0.2, 0.2, 1.0).</p></dd><dt><span class="term">
<code class="constant">GL_DIFFUSE</code>
</span></dt><dd><p><em class="parameter"><code>params</code></em>
contains four fixed-point or floating-point values that
specify the diffuse RGBA reflectance of the material.
The values are not clamped. The initial diffuse
reflectance is
(0.8, 0.8, 0.8, 1.0).</p></dd><dt><span class="term">
<code class="constant">GL_SPECULAR</code>
</span></dt><dd><p><em class="parameter"><code>params</code></em>
contains four fixed-point or floating-point values that
specify the specular RGBA reflectance of the material.
The values are not clamped. The initial specular
reflectance is
(0, 0, 0, 1).</p></dd><dt><span class="term">
<code class="constant">GL_EMISSION</code>
</span></dt><dd><p><em class="parameter"><code>params</code></em>
contains four fixed-point or floating-point values that
specify the RGBA emitted light intensity of the material.
The values are not clamped. The initial emission
intensity is
(0, 0, 0, 1).</p></dd><dt><span class="term">
<code class="constant">GL_SHININESS</code>
</span></dt><dd><p><em class="parameter"><code>params</code></em>
is a single fixed-point or floating-point value that
specifies the RGBA specular exponent of the material.
Only values in the range [0, 128] are accepted. The
initial specular exponent is 0.</p></dd><dt><span class="term">
<code class="constant">GL_AMBIENT_AND_DIFFUSE</code>
</span></dt><dd><p>Equivalent to calling <code class="function">glMaterial</code>
twice with the same parameter values, once with
<code class="constant">GL_AMBIENT</code>
and once with <code class="constant">GL_DIFFUSE</code>.</p></dd></dl></div></div><div class="refsect1" title="Notes"><a id="notes"></a><h2>Notes</h2><p>To change the diffuse and ambient material per vertex,
color material can be used.
To enable and disable
<code class="constant">GL_COLOR_MATERIAL</code>, call
<a class="citerefentry" href="glEnable"><span class="citerefentry"><span class="refentrytitle">glEnable</span></span></a> and
<a class="citerefentry" href="glDisable"><span class="citerefentry"><span class="refentrytitle">glDisable</span></span></a> with
argument <code class="constant">GL_COLOR_MATERIAL</code>.
Color material is initially disabled.
</p><p>While the ambient, diffuse, specular and emission
material parameters all have alpha components, only the diffuse
alpha component is used in the lighting computation.</p></div><div class="refsect1" title="Errors"><a id="errors"></a><h2>Errors</h2><p>
<code class="constant">GL_INVALID_ENUM</code> is generated if either
<em class="parameter"><code>face</code></em> or <em class="parameter"><code>pname</code></em>
is not an accepted value.
</p><p>
<code class="constant">GL_INVALID_VALUE</code>
is generated if a specular exponent outside the range [0, 128]
is specified.
</p></div><div class="refsect1" title="Associated Gets"><a id="associatedgets"></a><h2>Associated Gets</h2><p>
<a class="citerefentry" href="glGetMaterial"><span class="citerefentry"><span class="refentrytitle">glGetMaterial</span></span></a>
</p></div><div class="refsect1" title="See Also"><a id="seealso"></a><h2>See Also</h2><p>
<a class="citerefentry" href="glEnable"><span class="citerefentry"><span class="refentrytitle">glEnable</span></span></a>,
<a class="citerefentry" href="glLight"><span class="citerefentry"><span class="refentrytitle">glLight</span></span></a>,
<a class="citerefentry" href="glLightModel"><span class="citerefentry"><span class="refentrytitle">glLightModel</span></span></a>
</p></div><div class="refsect1" title="Copyright"><a id="copyright"></a><h2>Copyright</h2><p>
Copyright <span class="trademark"></span>© 2003-2004
Silicon Graphics, Inc. This document is licensed under the SGI
Free Software B License. For details, see
<a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
</p></div></div>