void glBlendFunc(GLenum sfactor, GLenum dfactor)
The argument sfactor indicates how to compute a source blending factor; dfactor indicates how to compute a destination blending factor. The possible values for these arguments are explained in the Table.
In the Table, the RGBA values of the source and destination are indicated with the subscripts s and d, respectively. Also, division of an RGBA quadruplet by a scalar means dividing each component by that value. Similarly, subtraction of quadruplets means subtracting them componentwise. The Relevant Factor column indicates whether the corresponding constant can be used to specify the source or destination blend factor.
Blending factors of RGB and A can be considered separately:
void glBlendFuncSeparate(GLenum srcRGB, GLenum destRGB, GLenum srcalpha, GLenum destalpha );
It still usees the table below.
| Constant | Relevant Factor | Computed Blend Factor |
|---|---|---|
| GL_ZERO | source or destination | (0, 0, 0, 0) |
| GL_ONE | source or destination | (1, 1, 1, 1) |
| GL_DST_COLOR | source | (Rd, Gd, Bd, Ad) |
| GL_SRC_COLOR | destination | (Rs, Gs, Bs, As) |
| GL_ONE_MINUS_DST_COLOR | source | (1, 1, 1, 1)-(Rd, Gd, Bd, Ad) |
| GL_ONE_MINUS_SRC_COLOR | destination | (1, 1, 1, 1)-(Rs, Gs, Bs, As) |
| GL_SRC_ALPHA | source or destination | (As, As, As, As) |
| GL_ONE_MINUS_SRC_ALPH A | source or destination | (1, 1, 1, 1)-(As, As, As, As) |
| GL_DST_ALPHA | source or destination | (Ad, Ad, Ad, Ad) |
| GL_ONE_MINUS_DST_ALPH A | source or destination | (1, 1, 1, 1)-(Ad, Ad, Ad, Ad) |
| GL_SRC_ALPHA_SATURATE | source | (f, f, f, 1); f=min(As, 1-Ad) |
| GL_CONSTANT_COLOR | source or destination | (Rc, Gc, Bc, Ac) |
| GL_ONE_MINUS_CONSTANT_COLOR | source or destination | (1, 1, 1, 1)-(Rc, Gc, Bc, Ac) |
| GL_CONSTANT_ALPHA | source or destination | (Ac, Ac, Ac, Ac) |
| GL_ONE_MINUS_CONSTANT_ALPHA | source or destination | (1, 1, 1, 1)-(Ac, Ac, Ac, Ac) |
The blend factors are assumed to lie in the range [0,1]; after the color values in the source and destination are combined, they're clamped to the range [0,1].
Using the constants GL_ONE (source) and GL_ZERO (destination) gives the same results as when blending is disabled; these values are the default.
If you use the GL*CONSTANT* blending function you need to use glBlendColor() to specify a constant color.
void glBlendColor( GLclamp red, GLclamp green, GLclamp blue, GLclamp alpha )