Graphics Reference
In-Depth Information
Table 11-3
Blending Functions
(continued)
Alpha Blending
Factor
Blending Coefficient Enum
RGB Blending Factors
GL_DST_COLOR
(
R
d
,
G
d
,
B
d
)
A
d
GL_ONE_MINUS_DST_COLOR
(1 −
R
d
, 1 −
G
d
, 1 −
B
d
)
1−
A
d
GL_DST_ALPHA
(
A
d
,
A
d
,
A
d
)
A
d
GL_ONE_MINUS_DST_ALPHA
(1 −
A
d
, 1 −
A
d
, 1 −
A
d
)
1 −
A
d
GL_CONSTANT_COLOR
(
R
c
,
G
c
,
B
c
)
A
c
GL_ONE_MINUS_CONSTANT_COLOR
(1 −
R
c
, 1 −
G
c
, 1 −
B
c
)
1 −
A
c
GL_CONSTANT_ALPHA
(
A
c
,
A
c
,
A
c
)
A
c
GL_ONE_MINUS_CONSTANT_ALPHA
(1 −
A
c
, 1 −
A
c
, 1 −
A
c
)
1 −
A
c
GL_SRC_ALPHA_SATURATE
min
(
A
s
, 1 −
A
d
)
1
In Table 11-3, (
R
s
,
G
s
,
B
s
,
A
s
) are the color components associated with the
incoming fragment color, (
R
d
,
G
d
,
B
d
,
A
d
) are the components associated
with the pixel color already in the color buffer, and (
R
a
,
G
c
,
B
c
,
A
c
) represent
a constant color that you set by calling
glBlendColor
. In the case of
GL_SRC_ALHPA_SATURATE
, the minimum value computed is applied to the
source color only.
void
glBlendColor
(GLfloat
red
, GLfloat
green
,
GLfloat
blue
, GLfloat
alpha
)
red, green,
specify the component values for the constant
blue,
blending color
alpha
Once the incoming fragment and pixel color have been multiplied by
their respective scaling factors, they are combined using the operator
specified by
glBlendEquation
or
glBlendEquationSeparate
. By
default, blended colors are accumulated using the
GL_FUNC_ADD
operator. The
GL_FUNC_SUBTRACT
operator subtracts the scaled color
from the framebuffer from the incoming fragment's value. Likewise, the