<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../style.css">
<title>
Gambas Documentation - Gl.AlphaFunc
 (gb.opengl)</title>
</head>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../../../help+en"><img class="flag" alt="Home" border="0" src="../../../../img/lang/en.png" align="center"></a>&nbsp;
<a href="../gl+en">Up</a>&nbsp;
<a href="accum+en">Previous</a>&nbsp;
<a href="getaccumalphabits+en">Next</a>&nbsp;
</td></tr></table>
<div class="notab">
<h1>
Gl.AlphaFunc
 (gb.opengl)</h1>
<div class="black"><font size="-2"><b>Syntax</b></font></div>
<pre class="syntax"><font color="blue">STATIC</font> <font color="blue">SUB</font> <b>AlphaFunc</b> <font color="blue">(</font> <u>Function</u> <font color="blue">AS</font> <font color="#0080FF">Integer</font><font color="blue">,</font> <u>Reference</u> <font color="blue">AS</font> <font color="#0080FF">Float</font> <font color="blue">)</font></pre>
<h3>AlphaFunc - Specify the alpha test function</h3>
<p>
The alpha test discards fragments depending on the outcome of a comparison between the incoming fragment's alpha value and a constant reference value. AlphaFunc specifies the reference and comparison function. The comparison is performed only if alpha testing is enabled. (See Gl.Enable and Gl.Disable of Gl.GL_ALPHA_TEST.)
<p>
<u>Function</u> and <u>Reference</u> specify the conditions under which the pixel is drawn. The incoming alpha value is compared to <u>Reference</u> using the function specified by <u>Function</u>. If the comparison passes, the incoming fragment is drawn, conditional on subsequent stencil and depth buffer tests. If the comparison fails, no change is made to the frame buffer at that pixel location.
<p>
The comparison functions are as follows:
<p>
<h4><b><a href="gl_never+en">Gl.GL_NEVER</a></b></h4>
<p>
&nbsp;&nbsp;Never passes.
<p>
<h4><b><a href="gl_less+en">Gl.GL_LESS</a></b></h4>
<p>
&nbsp;&nbsp;Passes if the incoming alpha value is less than the reference value.
<p>
<h4><b><a href="gl_equal+en">Gl.GL_EQUAL</a></b></h4>
<p>
&nbsp;&nbsp;Passes if the incoming alpha value is equal to the reference value.
<p>
<h4><b><a href="gl_lequal+en">Gl.GL_LEQUAL</a></b></h4>
<p>
&nbsp;&nbsp;Passes if the incoming alpha value is less than or equal to the reference value.
<p>
<h4><b><a href="gl_greater+en">Gl.GL_GREATER</a></b></h4>
<p>
&nbsp;&nbsp;&nbsp;Passes if the incoming alpha value is greater than the reference value.
<p>
<h4><b><a href="gl_notequal+en">Gl.GL_NOTEQUAL</a></b></h4>
<p>
&nbsp;&nbsp;&nbsp;Passes if the incoming alpha value is not equal to the reference value.
<p>
<h4><b><a href="gl_gequal+en">Gl.GL_GEQUAL</a></b></h4>
<p>
&nbsp;&nbsp;Passes if the incoming alpha value is greater than or equal to the reference value.
<p>
<h4><b><a href="gl_always+en">Gl.GL_ALWAYS</a></b></h4>
<p>
&nbsp;&nbsp;Always passes.
<p>
&nbsp;&nbsp;AlphaFunc operates on all pixel writes, including those resulting from the scan conversion of points, lines, polygons, and bitmaps, and from pixel draw and copy operations. AlphaFunc does not affect screen clear operations.
<p>
<div class="warning"><table class="none" border="0"><tr><td width="40" valign="top"><img border="0" src="../../../../img/info.png" align="center"></td><td valign="top">
Alpha testing is done only in RGBA mode.
</td></tr></table></div>
<p>
<h4><b>Errors</b></h4>
<p>
Gl.GL_INVALID_ENUM is generated if <u>Function</u> is not an accepted value.<br>
Gl.GL_INVALID_OPERATION is generated if AlphaFunc is called between a call to Gl.Begin and the corresponding call to Gl.End.<br>
<p>
<h4><b>Associated Gets</b></h4>
<p>
Gl.GetAlphaTestFunc<br>
Gl.GetAlphaTestRef<br>
Gl.IsEnabled with argument Gl.GL_ALPHA_TEST.
<p>
<hr><b>See also</b><br>
Gl.BlendFunc, Gl.Clear, Gl.DepthFunc, Gl.Enable, Gl.StencilFunc

</div>
</body>
</html>

