Commit | Line | Data |
---|---|---|
7faf1d71 AW |
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="glAlphaFunc"> | |
5 | <refmeta> | |
6 | <refmetainfo> | |
7 | <copyright> | |
8 | <year>1991-2006</year> | |
9 | <holder>Silicon Graphics, Inc.</holder> | |
10 | </copyright> | |
11 | </refmetainfo> | |
12 | <refentrytitle>glAlphaFunc</refentrytitle> | |
13 | <manvolnum>3G</manvolnum> | |
14 | </refmeta> | |
15 | <refnamediv> | |
16 | <refname>glAlphaFunc</refname> | |
17 | <refpurpose>specify the alpha test function</refpurpose> | |
18 | </refnamediv> | |
19 | <refsynopsisdiv><title>C Specification</title> | |
20 | <funcsynopsis> | |
21 | <funcprototype> | |
22 | <funcdef>void <function>glAlphaFunc</function></funcdef> | |
23 | <paramdef>GLenum <parameter>func</parameter></paramdef> | |
24 | <paramdef>GLclampf <parameter>ref</parameter></paramdef> | |
25 | </funcprototype> | |
26 | </funcsynopsis> | |
27 | </refsynopsisdiv> | |
28 | <refsect1 id="parameters"><title>Parameters</title> | |
29 | <variablelist> | |
30 | <varlistentry> | |
31 | <term><parameter>func</parameter></term> | |
32 | <listitem> | |
33 | <para> | |
34 | Specifies the alpha comparison function. | |
35 | Symbolic constants | |
36 | <constant>GL_NEVER</constant>, | |
37 | <constant>GL_LESS</constant>, | |
38 | <constant>GL_EQUAL</constant>, | |
39 | <constant>GL_LEQUAL</constant>, | |
40 | <constant>GL_GREATER</constant>, | |
41 | <constant>GL_NOTEQUAL</constant>, | |
42 | <constant>GL_GEQUAL</constant>, and | |
43 | <constant>GL_ALWAYS</constant> are accepted. The initial value is <constant>GL_ALWAYS</constant>. | |
44 | </para> | |
45 | </listitem> | |
46 | </varlistentry> | |
47 | <varlistentry> | |
48 | <term><parameter>ref</parameter></term> | |
49 | <listitem> | |
50 | <para> | |
51 | Specifies the reference value that incoming alpha values are compared to. | |
52 | This value is clamped to the range | |
53 | <inlineequation><mml:math> | |
54 | <!-- eqn: [0,1]:--> | |
55 | <mml:mfenced open="[" close="]"> | |
56 | <mml:mn>0</mml:mn> | |
57 | <mml:mn>1</mml:mn> | |
58 | </mml:mfenced> | |
59 | </mml:math></inlineequation>, | |
60 | where 0 represents the lowest possible alpha value | |
61 | and 1 the highest possible value. | |
62 | The initial reference value is 0. | |
63 | </para> | |
64 | </listitem> | |
65 | </varlistentry> | |
66 | </variablelist> | |
67 | </refsect1> | |
68 | <refsect1 id="description"><title>Description</title> | |
69 | <para> | |
70 | The alpha test discards fragments depending on the outcome of a comparison | |
71 | between an incoming fragment's alpha value and a constant reference value. | |
72 | <function>glAlphaFunc</function> specifies the reference value and the comparison function. | |
73 | The comparison is performed only if alpha testing is enabled. By | |
74 | default, it is not enabled. | |
75 | (See | |
76 | <citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry> and <citerefentry><refentrytitle>glDisable</refentrytitle></citerefentry> of <constant>GL_ALPHA_TEST</constant>.) | |
77 | </para> | |
78 | <para> | |
79 | <parameter>func</parameter> and <parameter>ref</parameter> specify the conditions under which | |
80 | the pixel is drawn. | |
81 | The incoming alpha value is compared to <parameter>ref</parameter> | |
82 | using the function specified by <parameter>func</parameter>. | |
83 | If the value passes the comparison, | |
84 | the incoming fragment is drawn | |
85 | if it also passes subsequent stencil and depth buffer tests. | |
86 | If the value fails the comparison, | |
87 | no change is made to the frame buffer at that pixel location. The | |
88 | comparison functions are as follows: | |
89 | </para> | |
90 | <variablelist> | |
91 | <varlistentry> | |
92 | <term><constant>GL_NEVER</constant></term> | |
93 | <listitem> | |
94 | <para> | |
95 | Never passes. | |
96 | </para> | |
97 | </listitem> | |
98 | </varlistentry> | |
99 | <varlistentry> | |
100 | <term><constant>GL_LESS</constant></term> | |
101 | <listitem> | |
102 | <para> | |
103 | Passes if the incoming alpha value is less than the reference value. | |
104 | </para> | |
105 | </listitem> | |
106 | </varlistentry> | |
107 | <varlistentry> | |
108 | <term><constant>GL_EQUAL</constant></term> | |
109 | <listitem> | |
110 | <para> | |
111 | Passes if the incoming alpha value is equal to the reference value. | |
112 | </para> | |
113 | </listitem> | |
114 | </varlistentry> | |
115 | <varlistentry> | |
116 | <term><constant>GL_LEQUAL</constant></term> | |
117 | <listitem> | |
118 | <para> | |
119 | Passes if the incoming alpha value is less than or equal to the reference value. | |
120 | </para> | |
121 | </listitem> | |
122 | </varlistentry> | |
123 | <varlistentry> | |
124 | <term><constant>GL_GREATER</constant></term> | |
125 | <listitem> | |
126 | <para> | |
127 | Passes if the incoming alpha value is greater than the reference value. | |
128 | </para> | |
129 | </listitem> | |
130 | </varlistentry> | |
131 | <varlistentry> | |
132 | <term><constant>GL_NOTEQUAL</constant></term> | |
133 | <listitem> | |
134 | <para> | |
135 | Passes if the incoming alpha value is not equal to the reference value. | |
136 | </para> | |
137 | </listitem> | |
138 | </varlistentry> | |
139 | <varlistentry> | |
140 | <term><constant>GL_GEQUAL</constant></term> | |
141 | <listitem> | |
142 | <para> | |
143 | Passes if the incoming alpha value is greater than or equal to | |
144 | the reference value. | |
145 | </para> | |
146 | </listitem> | |
147 | </varlistentry> | |
148 | <varlistentry> | |
149 | <term><constant>GL_ALWAYS</constant></term> | |
150 | <listitem> | |
151 | <para> | |
152 | Always passes (initial value). | |
153 | </para> | |
154 | </listitem> | |
155 | </varlistentry> | |
156 | </variablelist> | |
157 | <para> | |
158 | <function>glAlphaFunc</function> operates on all pixel write operations, | |
159 | including those resulting from the scan conversion of points, | |
160 | lines, | |
161 | polygons, | |
162 | and bitmaps, | |
163 | and from pixel draw and copy operations. | |
164 | <function>glAlphaFunc</function> does not affect screen clear operations. | |
165 | </para> | |
166 | </refsect1> | |
167 | <refsect1 id="notes"><title>Notes</title> | |
168 | <para> | |
169 | Alpha testing is performed only in RGBA mode. | |
170 | </para> | |
171 | </refsect1> | |
172 | <refsect1 id="errors"><title>Errors</title> | |
173 | <para> | |
174 | <constant>GL_INVALID_ENUM</constant> is generated if <parameter>func</parameter> is not an accepted value. | |
175 | </para> | |
176 | <para> | |
177 | <constant>GL_INVALID_OPERATION</constant> is generated if <function>glAlphaFunc</function> | |
178 | is executed between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> | |
179 | and the corresponding execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>. | |
180 | </para> | |
181 | </refsect1> | |
182 | <refsect1 id="associatedgets"><title>Associated Gets</title> | |
183 | <para> | |
184 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_ALPHA_TEST_FUNC</constant> | |
185 | </para> | |
186 | <para> | |
187 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_ALPHA_TEST_REF</constant> | |
188 | </para> | |
189 | <para> | |
190 | <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_ALPHA_TEST</constant> | |
191 | </para> | |
192 | </refsect1> | |
193 | <refsect1 id="seealso"><title>See Also</title> | |
194 | <para> | |
195 | <citerefentry><refentrytitle>glBlendFunc</refentrytitle></citerefentry>, | |
196 | <citerefentry><refentrytitle>glClear</refentrytitle></citerefentry>, | |
197 | <citerefentry><refentrytitle>glDepthFunc</refentrytitle></citerefentry>, | |
198 | <citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry>, | |
199 | <citerefentry><refentrytitle>glStencilFunc</refentrytitle></citerefentry> | |
200 | </para> | |
201 | </refsect1> | |
202 | <refsect1 id="Copyright"><title>Copyright</title> | |
203 | <para> | |
204 | Copyright <trademark class="copyright"></trademark> 1991-2006 | |
205 | Silicon Graphics, Inc. This document is licensed under the SGI | |
206 | Free Software B License. For details, see | |
207 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. | |
208 | </para> | |
209 | </refsect1> | |
210 | </refentry> |