1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id=
"gl_FrontFacing">
9 <holder>Khronos Group
</holder>
12 <refentrytitle>gl_FrontFacing
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>gl_FrontFacing
</refname>
17 <refpurpose>indicates whether a primitive is front or back facing
</refpurpose>
19 <refsynopsisdiv><title>Declaration
</title>
21 <function>in bool gl_FrontFacing;
</function>
24 <refsect1 id=
"description"><title>Description
</title>
26 Available only in the fragment language,
<function>gl_FrontFacing
</function> is an input variable
27 whose value is
<function>true
</function> if the fragment belongs to a front-facing primitive and
28 false otherwise. The determination of whether a triangle primitive is front-facing is made by
29 examining the sign of the area of the triangle, including a possible reversal of this sign
30 as controlled by
<function>glFrontFace
</function>. One way to compute this area is:
33 <inlineequation><mml:math>
34 <mml:mi>a
</mml:mi><mml:mo>=
</mml:mo><mml:mfrac><mml:mrow><mml:mn>1</mml:mn></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:mfrac>
35 <mml:msubsup><mml:mo>∑</mml:mo><mml:mrow>
36 <mml:mi>j
</mml:mi><mml:mo>=
</mml:mo><mml:mn>0</mml:mn>
39 <mml:mi>n
</mml:mi><mml:mo>-
</mml:mo><mml:mn>1</mml:mn>
40 </mml:mrow></mml:msubsup>
41 <mml:msubsup><mml:mi>x
</mml:mi><mml:mrow>w
</mml:mrow><mml:mrow><mml:mi>i
</mml:mi></mml:mrow></mml:msubsup>
42 <mml:msubsup><mml:mi>y
</mml:mi><mml:mrow>w
</mml:mrow><mml:mrow><mml:mi>i
</mml:mi><mml:mo>+
</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msubsup>
44 <mml:msubsup><mml:mi>x
</mml:mi><mml:mrow>w
</mml:mrow><mml:mrow><mml:mi>i
</mml:mi><mml:mo>+
</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msubsup>
45 <mml:msubsup><mml:mi>y
</mml:mi><mml:mrow>w
</mml:mrow><mml:mrow><mml:mi>i
</mml:mi></mml:mrow></mml:msubsup>
46 </mml:math></inlineequation>
49 where
<inlineequation><mml:math><mml:msubsup><mml:mi>x
</mml:mi><mml:mrow>w
</mml:mrow><mml:mrow><mml:mi>i
</mml:mi></mml:mrow></mml:msubsup></mml:math></inlineequation> and
50 <inlineequation><mml:math><mml:msubsup><mml:mi>y
</mml:mi><mml:mrow>w
</mml:mrow><mml:mrow><mml:mi>i
</mml:mi></mml:mrow></mml:msubsup></mml:math></inlineequation> are
51 the x and y window coordinates of the
<emphasis>i
</emphasis>th vertex of the n-vertex polygon.
54 <refsect1 id=
"versions"><title>Version Support
</title>
55 <informaltable frame=
"topbot">
56 <tgroup cols=
"3" align=
"left">
57 <colspec colwidth=
"1.1*" />
58 <colspec colwidth=
"1*" align=
"center" />
59 <colspec colwidth=
"1*" align=
"center" />
60 <colspec colwidth=
"1*" align=
"center" />
61 <colspec colwidth=
"1*" align=
"center" />
62 <colspec colwidth=
"1*" align=
"center" />
63 <colspec colwidth=
"1*" align=
"center" />
64 <colspec colwidth=
"1*" align=
"center" />
65 <colspec colwidth=
"1*" align=
"center" />
68 <entry rowsep=
"1" align=
"left"><emphasis role=
"bold">
71 <entry rowsep=
"1" align=
"left"><emphasis role=
"bold">
74 <entry rowsep=
"1" align=
"left"><emphasis role=
"bold">
77 <entry rowsep=
"1" align=
"left"><emphasis role=
"bold">
80 <entry rowsep=
"1" align=
"left"><emphasis role=
"bold">
83 <entry rowsep=
"1" align=
"left"><emphasis role=
"bold">
86 <entry rowsep=
"1" align=
"left"><emphasis role=
"bold">
89 <entry rowsep=
"1" align=
"left"><emphasis role=
"bold">
92 <entry rowsep=
"1" align=
"left"><emphasis role=
"bold">
101 <emphasis>Y
</emphasis> <!-- 1.10, OpenGL 2.0 -->
104 <emphasis>Y
</emphasis> <!-- 1.20, OpenGL 2.1 -->
107 <emphasis>Y
</emphasis> <!-- 1.30, OpenGL 3.0 -->
110 <emphasis>Y
</emphasis> <!-- 1.40, OpenGL 3.1 -->
113 <emphasis>Y
</emphasis> <!-- 1.50, OpenGL 3.2 -->
116 <emphasis>Y
</emphasis> <!-- 3.30, OpenGL 3.3 -->
119 <emphasis>Y
</emphasis> <!-- 4.00, OpenGL 4.0 -->
122 <emphasis>Y
</emphasis> <!-- 4.10, OpenGL 4.1 -->
129 <refsect1 id=
"seealso"><title>See Also
</title>
131 <citerefentry><refentrytitle>gl_FragCoord
</refentrytitle></citerefentry>
134 <refsect1 id=
"Copyright"><title>Copyright
</title>
136 Copyright
<trademark class=
"copyright"></trademark> 2011 Khronos Group.
137 This material may be distributed subject to the terms and conditions set forth in
138 the Open Publication License, v
1.0,
8 June
1999.
139 <ulink url=
"http://opencontent.org/openpub/">http://opencontent.org/openpub/
</ulink>.