📄 shademodel.html
字号:
<HTML>
<BODY>
<PRE>
<STRONG>NAME</STRONG>
<STRONG>glShadeModel</STRONG> - select flat or smooth shading
<STRONG>C</STRONG> <STRONG>SPECIFICATION</STRONG>
void <STRONG>glShadeModel</STRONG>( GLenum <EM>mode</EM> )
<STRONG>PARAMETERS</STRONG>
<EM>mode</EM> Specifies a symbolic value representing a shading
technique. Accepted values are <STRONG>GL_FLAT</STRONG> and <STRONG>GL_SMOOTH</STRONG>.
The initial value is <STRONG>GL_SMOOTH</STRONG>.
<STRONG>DESCRIPTION</STRONG>
GL primitives can have either flat or smooth shading.
Smooth shading, the default, causes the computed colors of
vertices to be interpolated as the primitive is rasterized,
typically assigning different colors to each resulting pixel
fragment. Flat shading selects the computed color of just
one vertex and assigns it to all the pixel fragments
generated by rasterizing a single primitive. In either
case, the computed color of a vertex is the result of
lighting if lighting is enabled, or it is the current color
at the time the vertex was specified if lighting is
disabled.
Flat and smooth shading are indistinguishable for points.
Starting when <STRONG>glBegin</STRONG> is issued and counting vertices and
primitives from 1, the GL gives each flat-shaded line
segment i the computed color of vertex i+1, its second
vertex. Counting similarly from 1, the GL gives each flat-
shaded polygon the computed color of the vertex listed in
the following table. This is the last vertex to specify the
polygon in all cases except single polygons, where the first
vertex specifies the flat-shaded color.
______________________________________
|<EM>primitive</EM> <EM>type</EM> <EM>of</EM> <EM>polygon</EM> i | <EM>vertex</EM> |
<EM>|</EM>____________________________<EM>|</EM>________|
|Single polygon (i<EM>=</EM>1) | 1 |
|Triangle strip | i+2 |
|Triangle fan | i+2 |
|Independent triangle | 3i |
|Quad strip | 2i+2 |
|Independent quad | 4i |
<EM>|</EM>____________________________<EM>|</EM>________|
Flat and smooth shading are specified by <STRONG>glShadeModel</STRONG> with
<EM>mode</EM> set to <STRONG>GL_FLAT</STRONG> and <STRONG>GL_SMOOTH</STRONG>, respectively.
<STRONG>ERRORS</STRONG>
<STRONG>GL_INVALID_ENUM</STRONG> is generated if <EM>mode</EM> is any value other than
<STRONG>GL_FLAT</STRONG> or <STRONG>GL_SMOOTH</STRONG>.
<STRONG>GL_INVALID_OPERATION</STRONG> is generated if <STRONG>glShadeModel</STRONG> is
executed between the execution of <STRONG>glBegin</STRONG> and the
corresponding execution of <STRONG>glEnd</STRONG>.
<STRONG>ASSOCIATED</STRONG> <STRONG>GETS</STRONG>
<STRONG>glGet</STRONG> with argument <STRONG>GL_SHADE_MODEL</STRONG>
<STRONG>SEE</STRONG> <STRONG>ALSO</STRONG>
<STRONG>glBegin</STRONG>, <STRONG>glColor</STRONG>, <STRONG>glLight</STRONG>, <STRONG>glLightModel</STRONG>
</PRE>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -