Blending

Could someone explain these for me in some way that makes more sense. I understand the concept of blending and alpha. And I know that GL_ZERO is the destination the pixel drawn first. and GL_ONE is the source. But I don’t understand these macros

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_ALPHA 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_ALPHA 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)

the blend equation is always:

srcFactor * srcColor + dstFactor * dstColor

all you do is plug in the src and dst factors, the GL_* enums in the glBlendFunc( S, D ) call.

srcColor is the incoming fragment, dstColor is the color in the frame buffer.

so source factor and distance factor must add to 100% right?

it depends. if it’s src_alpha 1-src_alpha, then yes. if it’s dst_color and src_color, then no. it depends.

there are names for the common blending ops:

add = one one
modulate or filter = zero src_color or dst_color zero
modulate2x = dst_color src_color
blend = src_alpha one_minus_src_alpha
opaque = one zero

if that helps at all.