afunction(3G) afunction(3G)
NAME
afunction - specify alpha test function
C SPECIFICATION
void afunction(ref, func)
long ref, func;
PARAMETERS
ref expects a reference value with which to compare source alpha at
each pixel. This value should be in the range 0 through 255.
func is a symbolic constant taken from the list below. It identifies
the alpha comparison function: AFNEVER, AFLESS, AFEQUAL,
AFLEQUAL, AFGREATER, AFNOTEQUAL, AFGEQUAL, and AFALWAYS.
AFALWAYS is the default.
DESCRIPTION
afunction makes the drawing of pixels conditional on the relationship of
the incoming alpha value with a reference constant value. It is
typically used to avoid updating either the color or the z bitplanes of a
framebuffer pixel when the incoming pixel is completely transparent.
Arguments ref and func specify the conditions under which the pixel will
be drawn. The incoming (source) alpha value is compared against ref with
function func. This comparison function is specified with the symbolic
constants:
AFNEVER Never pass.
AFLESS Pass if alpha is less than ref.
AFEQUAL Pass if alpha is equal to ref.
AFLEQUAL Pass if alpha is less than or equal to ref.
AFGREATER Pass if alpha is greater than ref.
AFGEQUAL Pass if alpha is greater than or equal to ref.
AFNOTEQUAL Pass if alpha is not equal to ref.
AFALWAYS Always pass.
If the comparison passes, the incoming pixel is drawn (conditional on
subsequent other tests like z-buffer).
afunction can be called with arguments 0,AFNOTEQUAL to defeat drawing of
completely transparent pixels. This assumes that incoming alpha is
proportional to pixel coverage, as it is when either pointsmooth or
linesmooth is being used.
Page 1
afunction(3G) afunction(3G)
afunction testing follows scan conversion and texture mapping but
precedes all other pixel tests. Thus, if the test fails, color, zbuffer
and stencil contents will not be modified.
afunction operates on all pixel writes, including those resulting from
the scan conversion of points, lines, and polygons, and from pixel write
and copy operations. afunction does not affect screen clear operation,
however.
SEE ALSO
blendfunction
NOTES
IRIS-4D G, GT, and GTX models, and the Personal Iris, do not support
afunction. Use getgdesc to determine what support is available for
afunction.
BUGS
On IRIS-4D VGX, XS, XS24, XZ, Elan and Extreme models, afunction cannot
be enabled while stencil is being used. Also on these models, only
AFNOTEQUAL with ref equal to 0 and AFALWAYS are supported.
Page 2