<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:mml="http://www.w3.org/1998/Math/MathML"
><head><title>glAlphaFunc</title><link rel="stylesheet" href="style.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.59.1"/><link rel="home" href="index.xml" title="PyOpenGL 2.0.1.07 Man Pages"/><link rel="up" href="reference-GL.xml" title="GL"/><link rel="previous" href="glActiveTextureARB.3G.xml" title="glActiveTextureARB"/><link rel="next" href="glAreTexturesResident.3G.xml" title="glAreTexturesResident"/></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">glAlphaFunc</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="glActiveTextureARB.3G.xml">Prev</a> </td><th width="60%" align="center">GL</th><td width="20%" align="right"> <a accesskey="n" href="glAreTexturesResident.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="glAlphaFunc.3G"/><div class="titlepage"/><div class="refnamediv"><a name="glAlphaFunc.3G-name"/><h2>Name</h2><p>glAlphaFunc &#8212; specify the alpha test function</p></div><div class="refsynopsisdiv"><a name="glAlphaFunc.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glAlphaFunc</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum <i><tt>func</tt></i>, GLclampf <i><tt>ref</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glAlphaFunc.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glAlphaFunc</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>func</tt></i>, <i><tt>ref</tt></i>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glAlphaFunc.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>func</tt></i></span></dt><dd>
						Specifies the alpha comparison function. Symbolic constants <tt>GL_NEVER</tt>,
						<tt>GL_LESS</tt>, <tt>GL_EQUAL</tt>, <tt>GL_LEQUAL</tt>,
						<tt>GL_GREATER</tt>, <tt>GL_NOTEQUAL</tt>, <tt>GL_GEQUAL</tt>, and
						<tt>GL_ALWAYS</tt> are accepted. The initial value is <tt>GL_ALWAYS</tt>.
					</dd><dt><span class="term"><i><tt>ref</tt></i></span></dt><dd>
						Specifies the reference value that incoming alpha values are compared to. This value is clamped to the
						range <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mfenced separator="," open="[" close="]">
									<mml:mn>0</mml:mn>
									<mml:mn>1</mml:mn>
								</mml:mfenced>
							</mml:math>, where 0 represents the lowest possible alpha value and 1 the highest possible value. The
						initial reference value is 0.
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="glAlphaFunc.3G-description"/><h2>Description</h2><p>
			The alpha test discards fragments depending on the outcome of a comparison between an incoming fragment's alpha value
			and a constant reference value. <tt>glAlphaFunc</tt> specifies the reference value and the comparison
			function. The comparison is performed only if alpha testing is enabled. By default, it is not enabled. (See <a href="glEnable.3G.xml"><tt>glEnable</tt></a> and <a href="glEnable.3G.xml"><tt>glDisable</tt></a> of
			<tt>GL_ALPHA_TEST</tt>.)
		</p><p>
			<i><tt>func</tt></i> and <i><tt>ref</tt></i> specify the conditions under which the pixel is drawn. The
			incoming alpha value is compared to <i><tt>ref</tt></i> using the function specified by
			<i><tt>func</tt></i>. If the value passes the comparison, the incoming fragment is drawn if it also passes
			subsequent stencil and depth buffer tests. If the value fails the comparison, no change is made to the frame buffer at
			that pixel location. The comparison functions are as follows:
		</p><div class="variablelist"><dl><dt><span class="term"><tt>GL_NEVER</tt></span></dt><dd>
						Never passes.
					</dd><dt><span class="term"><tt>GL_LESS</tt></span></dt><dd>
						Passes if the incoming alpha value is less than the reference value.
					</dd><dt><span class="term"><tt>GL_EQUAL</tt></span></dt><dd>
						Passes if the incoming alpha value is equal to the reference value.
					</dd><dt><span class="term"><tt>GL_LEQUAL</tt></span></dt><dd>
						Passes if the incoming alpha value is less than or equal to the reference value.
					</dd><dt><span class="term"><tt>GL_GREATER</tt></span></dt><dd>
						Passes if the incoming alpha value is greater than the reference value.
					</dd><dt><span class="term"><tt>GL_NOTEQUAL</tt></span></dt><dd>
						Passes if the incoming alpha value is not equal to the reference value.
					</dd><dt><span class="term"><tt>GL_GEQUAL</tt></span></dt><dd>
						Passes if the incoming alpha value is greater than or equal to the reference value.
					</dd><dt><span class="term"><tt>GL_ALWAYS</tt></span></dt><dd>
						Always passes (initial value).
					</dd></dl></div><p>
			<tt>glAlphaFunc</tt> operates on all pixel write operations, including those resulting from the scan
			conversion of points, lines, polygons, and bitmaps, and from pixel draw and copy operations.
			<tt>glAlphaFunc</tt> does not affect screen clear operations.
		</p></div><div class="refsect1" lang="en"><a name="glAlphaFunc.3G-notes"/><h2>Notes</h2><p>
			Alpha testing is performed only in RGBA mode.
		</p></div><div class="refsect1" lang="en"><a name="glAlphaFunc.3G-errors"/><h2>Errors</h2><p>
			<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>func</tt></i> is not an accepted value.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <tt>glAlphaFunc</tt> is executed between the
			execution of <a href="glBegin.3G.xml"><tt>glBegin</tt></a> and the corresponding execution of <a href="glBegin.3G.xml"><tt>glEnd</tt></a>.
		</p></div><div class="refsect1" lang="en"><a name="glAlphaFunc.3G-associated_gets"/><h2>Associated Gets</h2><p>
			<tt>glGet</tt> with argument <tt>GL_ALPHA_TEST_FUNC</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_ALPHA_TEST_REF</tt>
		</p><p>
			<a href="glIsEnabled.3G.xml"><tt>glIsEnabled</tt></a> with argument <tt>GL_ALPHA_TEST</tt>
		</p></div><div class="refsect1" lang="en"><a name="glAlphaFunc.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glBlendFunc.3G.xml">glBlendFunc</a>, <a href="glClear.3G.xml">glClear</a>, <a href="glDepthFunc.3G.xml">glDepthFunc</a>, <a href="glEnable.3G.xml">glEnable</a>, <a href="glStencilFunc.3G.xml">glStencilFunc</a></span>
		</p></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="glActiveTextureARB.3G.xml">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-GL.xml">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="glAreTexturesResident.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">glActiveTextureARB </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> glAreTexturesResident</td></tr></table></div></body></html>