glBlendEquation.3   [plain text]


'\" te  
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp May 22 14:44
.ds Dm 1 May 22 14:
.ds Xs 36751     7
.TH GLBLENDEQUATION 3G
.SH NAME
.B "glBlendEquation
\- set the blend equation

.SH C SPECIFICATION
void \f3glBlendEquation\fP(
GLenum \fImode\fP )
.nf
.fi

.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\f2mode\fP\ \ 'u 
\f2mode\fP
specifies how source and destination colors are combined.
It must be \%\f3GL_FUNC_ADD\fP, \%\f3GL_FUNC_SUBTRACT\fP,
\%\f3GL_FUNC_REVERSE_SUBTRACT\fP, \%\f3GL_MIN\fP, \%\f3GL_MAX\fP.

.SH DESCRIPTION
The blend equation determines how a new pixel (the ``source'' color)
is combined with a pixel already in the framebuffer (the ``destination''
color).
.TP
\%\f3GL_MIN\fP
sets the blend equation so that each component of the result color
is the minimum of the corresponding components of the source and destination
colors.
.TP
\%\f3GL_MAX\fP
sets the blend equation so that each component of the result color
is the maximum of the corresponding components of the source and destination
colors.
.P
The remaining blend equations use the source and destination blend factors
specified by \%\f3glBlendFunc\fP.
See \%\f3glBlendFunc\fP for a description of the various blend factors. 
.P
In the equations that follow, source and destination
color components are referred to as
$(R sub s, G sub s, B sub s, A sub s )$ 
and
$(R sub d, G sub d, B sub d, A sub d )$,
respectively.
The result color is referred to as 
$(R sub r, G sub r, B sub r, A sub r )$.
The source and destination blend factors are denoted 
$(s sub R, s sub G, s sub B, s sub A )$ and 
$(d sub R, d sub G, d sub B, d sub A )$, respectively.
For these equations all color components are understood to have values
in the range [0,\ 1].
.TP
\%\f3GL_FUNC_ADD\fP
sets the blend equation so that the source and destination
data are added.
Each component of the source color is
multiplied by the corresponding source factor, then
each component of the destination color is multiplied
by the corresponding destination factor.
The result is the componentwise sum of the two products, clamped to the
range [0,\ 1].
.P
.RS
.nf
.IP
$Rr ~=~ mark   min (1, ~R sub s~s sub R ~+~ R sub d~d sub R )$
$Gr ~=~ lineup min (1, ~G sub s~s sub G ~+~ G sub d~d sub G )$
$Br ~=~ lineup min (1, ~B sub s~s sub B ~+~ B sub d~d sub B )$
$Ar ~=~ lineup min (1, ~A sub s~s sub A ~+~ A sub d~d sub A )$
.fi
.RE
.TP
\%\f3GL_FUNC_SUBTRACT\fP
Is like \%\f3GL_FUNC_ADD\fP except the product of the destination factor and
the destination color is componentwise subtracted from the product of the
source factor and the source color.
The result is clamped to the range [0,\ 1].
.RS
.nf
.IP
$Rr ~=~ mark   max (0 , ~R sub s~s sub R ~-~ R sub d~d sub R )$
$Gr ~=~ lineup max (0 , ~G sub s~s sub G ~-~ G sub d~d sub G )$
$Br ~=~ lineup max (0 , ~B sub s~s sub B ~-~ B sub d~d sub B )$
$Ar ~=~ lineup max (0 , ~A sub s~s sub A ~-~ A sub d~d sub A )$
.fi
.RE
.TP
\%\f3GL_FUNC_REVERSE_SUBTRACT\fP
Is like \%\f3GL_FUNC_ADD\fP except the product of the source factor and the
source color is componentwise subtracted from the product of the destination
factor and the destination color.
The result is clamped to the range [0,\ 1].
.RS
.nf
.IP
$Rr ~=~ mark   max (0 , ~R sub d~d sub R ~-~ R sub s~s sub R )$
$Gr ~=~ lineup max (0 , ~G sub d~d sub G ~-~ G sub s~s sub G )$
$Br ~=~ lineup max (0 , ~B sub d~d sub B ~-~ B sub s~s sub B )$
$Ar ~=~ lineup max (0 , ~A sub d~d sub A ~-~ A sub s~s sub A )$
.fi
.RE
.P
The \%\f3GL_MIN\fP and \%\f3GL_MAX\fP equations are useful for applications
that analyze
.br
image data (image thresholding against a constant color,
for example).
The \%\f3GL_FUNC_ADD\fP equation is useful
for antialiasing and transparency, among other things.
.P
Initially, the blend equation is set to \%\f3GL_FUNC_ADD\fP.
.P
.SH NOTES
\%\f3glBlendEquation\fP is part of the \%\f3GL_ARB_imaging\fP subset. \%\f3glBlendEquation\fP is present only
if \%\f3GL_ARB_imaging\fP is returned when \%\f3glGetString\fP is called with
\%\f3GL_EXTENSIONS\fP as its argument.
.P
The \%\f3GL_MIN\fP, and \%\f3GL_MAX\fP equations do not use
the source or destination factors, only the source and destination colors.
.P
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if \f2mode\fP is not one of 
\%\f3GL_FUNC_ADD\fP, \%\f3GL_FUNC_SUBTRACT\fP, \%\f3GL_FUNC_REVERSE_SUBTRACT\fP,
\%\f3GL_MAX\fP, or \%\f3GL_MIN\fP.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glBlendEquation\fP is executed
between the execution of \%\f3glBegin\fP and the corresponding
execution of \%\f3glEnd\fP.
.SH ASSOCIATED GETS
.TP
\%\f3glGet\fP with an argument of \%\f3GL_BLEND_EQUATION\fP
.SH SEE ALSO
\%\f3glGetString\fP,
\%\f3glBlendColor\fP,
\%\f3glBlendFunc\fP