Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> |
2 | <!-- saved from url=(0013)about:internet --> | |
3 | <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>glShadeModel</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glShadeModel"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glShadeModel — select flat or smooth shading</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glShadeModel</b>(</code></td><td>GLenum </td><td><var class="pdparam">mode</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>mode</code></em></span></dt><dd><p> | |
4 | Specifies a symbolic value representing a shading technique. | |
5 | Accepted values are <code class="constant">GL_FLAT</code> and <code class="constant">GL_SMOOTH</code>. | |
6 | The initial value is <code class="constant">GL_SMOOTH</code>. | |
7 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
8 | GL primitives can have either flat or smooth shading. | |
9 | Smooth shading, | |
10 | the default, | |
11 | causes the computed colors of vertices to be interpolated as the | |
12 | primitive is rasterized, | |
13 | typically assigning different colors to each resulting pixel fragment. | |
14 | Flat shading selects the computed color of just one vertex | |
15 | and assigns it to all the pixel fragments | |
16 | generated by rasterizing a single primitive. | |
17 | In either case, the computed color of a vertex is the result of | |
18 | lighting if lighting is enabled, | |
19 | or it is the current color at the time the vertex was specified if | |
20 | lighting is disabled. | |
21 | </p><p> | |
22 | Flat and smooth shading are indistinguishable for points. | |
23 | Starting when <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> is issued and counting vertices and | |
24 | primitives from 1, the GL gives each flat-shaded line segment | |
25 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">i</mml:mi></mml:math> | |
26 | the | |
27 | computed color of vertex | |
28 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
29 | ||
30 | <mml:mrow> | |
31 | <mml:mi mathvariant="italic">i</mml:mi> | |
32 | <mml:mo>+</mml:mo> | |
33 | <mml:mn>1</mml:mn> | |
34 | </mml:mrow> | |
35 | </mml:math>, | |
36 | its second vertex. | |
37 | Counting similarly from 1, | |
38 | the GL gives each flat-shaded polygon the computed color of the vertex listed | |
39 | in the following table. | |
40 | This is the last vertex to specify the polygon in all cases except single | |
41 | polygons, | |
42 | where the first vertex specifies the flat-shaded color. | |
43 | </p><p> | |
44 | </p><div class="informaltable"><table border="1"><colgroup><col align="left" /><col align="center" /></colgroup><thead><tr><th align="left"><span class="bold"><strong> | |
45 | Primitive Type of Polygon | |
46 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">i</mml:mi></mml:math> | |
47 | </strong></span></th><th align="center"><span class="bold"><strong> | |
48 | Vertex | |
49 | </strong></span></th></tr></thead><tbody><tr><td align="left"> | |
50 | Single polygon | |
51 | (<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
52 | ||
53 | <mml:mrow> | |
54 | <mml:mi mathvariant="italic">i</mml:mi> | |
55 | <mml:mo>==</mml:mo> | |
56 | <mml:mn>1</mml:mn> | |
57 | </mml:mrow> | |
58 | </mml:math>) | |
59 | </td><td align="center"> | |
60 | 1 | |
61 | </td></tr><tr><td align="left"> | |
62 | Triangle strip | |
63 | </td><td align="center"> | |
64 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
65 | ||
66 | <mml:mrow> | |
67 | <mml:mi mathvariant="italic">i</mml:mi> | |
68 | <mml:mo>+</mml:mo> | |
69 | <mml:mn>2</mml:mn> | |
70 | </mml:mrow> | |
71 | </mml:math> | |
72 | </td></tr><tr><td align="left"> | |
73 | Triangle fan | |
74 | </td><td align="center"> | |
75 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
76 | ||
77 | <mml:mrow> | |
78 | <mml:mi mathvariant="italic">i</mml:mi> | |
79 | <mml:mo>+</mml:mo> | |
80 | <mml:mn>2</mml:mn> | |
81 | </mml:mrow> | |
82 | </mml:math> | |
83 | </td></tr><tr><td align="left"> | |
84 | Independent triangle | |
85 | </td><td align="center"> | |
86 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
87 | ||
88 | <mml:mrow> | |
89 | <mml:mn>3</mml:mn> | |
90 | <mml:mo></mml:mo> | |
91 | <mml:mi mathvariant="italic">i</mml:mi> | |
92 | </mml:mrow> | |
93 | </mml:math> | |
94 | </td></tr><tr><td align="left"> | |
95 | Quad strip | |
96 | </td><td align="center"> | |
97 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
98 | ||
99 | <mml:mrow> | |
100 | <mml:mn>2</mml:mn> | |
101 | <mml:mo></mml:mo> | |
102 | <mml:mi mathvariant="italic">i</mml:mi> | |
103 | <mml:mo>+</mml:mo> | |
104 | <mml:mn>2</mml:mn> | |
105 | </mml:mrow> | |
106 | </mml:math> | |
107 | </td></tr><tr><td align="left"> | |
108 | Independent quad | |
109 | </td><td align="center"> | |
110 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
111 | ||
112 | <mml:mrow> | |
113 | <mml:mn>4</mml:mn> | |
114 | <mml:mo></mml:mo> | |
115 | <mml:mi mathvariant="italic">i</mml:mi> | |
116 | </mml:mrow> | |
117 | </mml:math> | |
118 | </td></tr></tbody></table></div><p> | |
119 | Flat and smooth shading are specified by <code class="function">glShadeModel</code> with <em class="parameter"><code>mode</code></em> set to | |
120 | <code class="constant">GL_FLAT</code> and <code class="constant">GL_SMOOTH</code>, respectively. | |
121 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> | |
122 | <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>mode</code></em> is any value other than | |
123 | <code class="constant">GL_FLAT</code> or <code class="constant">GL_SMOOTH</code>. | |
124 | </p><p> | |
125 | <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glShadeModel</code> | |
126 | is executed between the execution of <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> | |
127 | and the corresponding execution of <a class="citerefentry" href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>. | |
128 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p> | |
129 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_SHADE_MODEL</code> | |
130 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
131 | <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a>, | |
132 | <a class="citerefentry" href="glColor.xml"><span class="citerefentry"><span class="refentrytitle">glColor</span></span></a>, | |
133 | <a class="citerefentry" href="glLight.xml"><span class="citerefentry"><span class="refentrytitle">glLight</span></span></a>, | |
134 | <a class="citerefentry" href="glLightModel.xml"><span class="citerefentry"><span class="refentrytitle">glLightModel</span></span></a> | |
135 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
136 | Copyright <span class="trademark"></span>© 1991-2006 | |
137 | Silicon Graphics, Inc. This document is licensed under the SGI | |
138 | Free Software B License. For details, see | |
139 | <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. | |
140 | </p></div></div></body></html> |