Mix (a substance) with another substance so that they combine together. or
Mix (a color) with another color so that they combine together.
In this section, we discuss blending pixel colors. Once a fragment passes all of the enabled fragment tests, its color can be combined with the color that’s already present in the fragment’s pixel location. Before the two colors are combined, they’re multiplied by a scaling factor and combined using the specified blending operator. The blending equation is
Cfinal = sfsource Clrsource opr sfdestination Clrdestination
where sfsource and Clrsource are the incoming fragment’s scaling factor and color, respectively. Likewise, sfdestination and Clrdestination are the pixel’s scaling factor
and color. opr 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
The possible values for the blending coefficients are
(Rs, Gs, Bs, As) are the color components associated with the incoming fragment color, (Rd, Gd, Bd, Ad) are the components associated with the pixel color already in the color buffer, and (Rc, Gc, Bc, Ac) represent a constant color that you set by calling glBlendColor. In the case of GL_SRC_ALHPA_SATURATE, the minimum value that’s computed is applied to the source color only.
void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
red, green, blue, alpha specify the component values for the constant blending color
Once the incoming fragment and pixel color have been multiplied by their respective scaling factors, they’re 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 GL_FUNC_REVERSE_SUBTRACT reverses the blending equation such that the incoming fragment colors are subtracted from the current pixel value.
void glBlendEquation(GLenum mode);
mode specify the blending operator. Valid values are GL_FUNC_ADD,
GL_FUNC_SUBTRACT, or GL_FUNC_REVERSE_SUBTRACT
void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
modeRGB specify the blending operator for the red, green, and blue components
modeAlpha specify the alpha component blending operator
Okayyy copy and paste is over, oh god I forgot read what I have copied!