Graphics Reference
In-Depth Information
where
f
source
and
C
source
are the incoming fragment's scaling factor and color,
respectively. Likewise,
f
destination
and
C
destination
are the pixel's scaling factor and
color, and op is the mathematical operator for combining the scaled values.
The scaling factors are specified by calling either
glBlendFunc
or
glBlendFuncSeparate
.
void
glBlendFunc
(GLenum
sfactor,
GLenum
dfactor)
sfactor
specifies the blending coefficient for the incoming fragment
dfactor
specifies the blending coefficient for the destination pixel
void
glBlendFuncSeparate
(GLenum
srcRGB
, GLenum
dstRGB
,
GLenum
srcAlpha
, GLenum
dstAlpha
)
srcRGB
specifies the blending coefficient for the incoming fragment's
red, green, and blue components
dstRGB
specifies the blending coefficient for the destination pixel's
red, green, and blue components
srcAlpha
specifies the blending coefficient for the incoming fragment's
alpha value
dstAlpha
specifies the blending coefficient for the destination pixel's
alpha value
The possible values for the blending coefficients are shown in Table 11-3.
Table 11-3
Blending Functions
Alpha Blending
Blending Coefficient Enum
RGB Blending Factors
Factor
GL_ZERO
(0, 0, 0)
0
GL_ONE
(1, 1, 1)
1
GL_SRC_COLOR
(
R
s
,
G
s
,
B
s
)
A
s
GL_ONE_MINUS_SRC_COLOR
(1 -
R
s
, 1 -
G
s
, 1 -
B
s
)
1 -
A
s
GL_SRC_ALPHA
(
A
s
,
A
s
,
A
s
)
A
s
GL_ONE_MINUS_SRC_ALPHA
(1 -
A
s
, 1 -
A
s
, 1 -
A
s
)
1 -
A
s