mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-25 18:55:35 +00:00
233 lines
10 KiB
XML
233 lines
10 KiB
XML
<?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="glShadeModel">
|
|
<refmeta>
|
|
<refmetainfo>
|
|
<copyright>
|
|
<year>1991-2006</year>
|
|
<holder>Silicon Graphics, Inc.</holder>
|
|
</copyright>
|
|
</refmetainfo>
|
|
<refentrytitle>glShadeModel</refentrytitle>
|
|
<manvolnum>3G</manvolnum>
|
|
</refmeta>
|
|
<refnamediv>
|
|
<refname>glShadeModel</refname>
|
|
<refpurpose>select flat or smooth shading</refpurpose>
|
|
</refnamediv>
|
|
<refsynopsisdiv><title>C Specification</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>void <function>glShadeModel</function></funcdef>
|
|
<paramdef>GLenum <parameter>mode</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
<!-- eqn: ignoring delim $$ -->
|
|
<refsect1 id="parameters"><title>Parameters</title>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>mode</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Specifies a symbolic value representing a shading technique.
|
|
Accepted values are <constant>GL_FLAT</constant> and <constant>GL_SMOOTH</constant>.
|
|
The initial value is <constant>GL_SMOOTH</constant>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</refsect1>
|
|
<refsect1 id="description"><title>Description</title>
|
|
<para>
|
|
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.
|
|
</para>
|
|
<para>
|
|
Flat and smooth shading are indistinguishable for points.
|
|
Starting when <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> is issued and counting vertices and
|
|
primitives from 1, the GL gives each flat-shaded line segment
|
|
<inlineequation><mml:math><mml:mi mathvariant="italic">i</mml:mi></mml:math></inlineequation>
|
|
the
|
|
computed color of vertex
|
|
<inlineequation><mml:math>
|
|
<!-- eqn: i + 1:-->
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">i</mml:mi>
|
|
<mml:mo>+</mml:mo>
|
|
<mml:mn>1</mml:mn>
|
|
</mml:mrow>
|
|
</mml:math></inlineequation>,
|
|
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.
|
|
</para>
|
|
<para>
|
|
</para>
|
|
<informaltable frame="topbot">
|
|
<tgroup cols="2" align="left">
|
|
<colspec/>
|
|
<colspec align="center"/>
|
|
<thead>
|
|
<row>
|
|
<entry rowsep="1" align="left"><emphasis role="bold">
|
|
Primitive Type of Polygon
|
|
<inlineequation><mml:math><mml:mi mathvariant="italic">i</mml:mi></mml:math></inlineequation>
|
|
</emphasis></entry>
|
|
<entry rowsep="1" align="center"><emphasis role="bold">
|
|
Vertex
|
|
</emphasis></entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry align="left">
|
|
Single polygon
|
|
(<inlineequation><mml:math>
|
|
<!-- eqn: i == 1:-->
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">i</mml:mi>
|
|
<mml:mo>==</mml:mo>
|
|
<mml:mn>1</mml:mn>
|
|
</mml:mrow>
|
|
</mml:math></inlineequation>)
|
|
</entry>
|
|
<entry align="center">
|
|
1
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry align="left">
|
|
Triangle strip
|
|
</entry>
|
|
<entry align="center">
|
|
<inlineequation><mml:math>
|
|
<!-- eqn: i + 2:-->
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">i</mml:mi>
|
|
<mml:mo>+</mml:mo>
|
|
<mml:mn>2</mml:mn>
|
|
</mml:mrow>
|
|
</mml:math></inlineequation>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry align="left">
|
|
Triangle fan
|
|
</entry>
|
|
<entry align="center">
|
|
<inlineequation><mml:math>
|
|
<!-- eqn: i + 2:-->
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">i</mml:mi>
|
|
<mml:mo>+</mml:mo>
|
|
<mml:mn>2</mml:mn>
|
|
</mml:mrow>
|
|
</mml:math></inlineequation>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry align="left">
|
|
Independent triangle
|
|
</entry>
|
|
<entry align="center">
|
|
<inlineequation><mml:math>
|
|
<!-- eqn: 3 i:-->
|
|
<mml:mrow>
|
|
<mml:mn>3</mml:mn>
|
|
<mml:mo>⁢</mml:mo>
|
|
<mml:mi mathvariant="italic">i</mml:mi>
|
|
</mml:mrow>
|
|
</mml:math></inlineequation>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry align="left">
|
|
Quad strip
|
|
</entry>
|
|
<entry align="center">
|
|
<inlineequation><mml:math>
|
|
<!-- eqn: 2 i + 2:-->
|
|
<mml:mrow>
|
|
<mml:mn>2</mml:mn>
|
|
<mml:mo>⁢</mml:mo>
|
|
<mml:mi mathvariant="italic">i</mml:mi>
|
|
<mml:mo>+</mml:mo>
|
|
<mml:mn>2</mml:mn>
|
|
</mml:mrow>
|
|
</mml:math></inlineequation>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry align="left">
|
|
Independent quad
|
|
</entry>
|
|
<entry align="center">
|
|
<inlineequation><mml:math>
|
|
<!-- eqn: 4 i:-->
|
|
<mml:mrow>
|
|
<mml:mn>4</mml:mn>
|
|
<mml:mo>⁢</mml:mo>
|
|
<mml:mi mathvariant="italic">i</mml:mi>
|
|
</mml:mrow>
|
|
</mml:math></inlineequation>
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
<para>
|
|
Flat and smooth shading are specified by <function>glShadeModel</function> with <parameter>mode</parameter> set to
|
|
<constant>GL_FLAT</constant> and <constant>GL_SMOOTH</constant>, respectively.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 id="errors"><title>Errors</title>
|
|
<para>
|
|
<constant>GL_INVALID_ENUM</constant> is generated if <parameter>mode</parameter> is any value other than
|
|
<constant>GL_FLAT</constant> or <constant>GL_SMOOTH</constant>.
|
|
</para>
|
|
<para>
|
|
<constant>GL_INVALID_OPERATION</constant> is generated if <function>glShadeModel</function>
|
|
is executed between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry>
|
|
and the corresponding execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 id="associatedgets"><title>Associated Gets</title>
|
|
<para>
|
|
<citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_SHADE_MODEL</constant>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 id="seealso"><title>See Also</title>
|
|
<para>
|
|
<citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry>,
|
|
<citerefentry><refentrytitle>glColor</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>
|