glBlendEquationEXT

NAME

glBlendEquationEXT - set the blend equation

C SPECIFICATION

void glBlendEquationEXT(GLenum mode)

PARAMETERS

mode Specify how source and destination colors are combined.

DESCRIPTION

glBlendEquationEXT determines how the source and destination colors are combined. The possible values for mode are GL_MIN_EXT, GL_MAX_EXT, GL_FUNC_SUBTRACT_EXT, GL_FUNC_REVERSE_SUBTRACT_EXT, and GL_FUNC_ADD_EXT. The initial value is GL_FUNC_ADD_EXT.

In the descriptions that follow, the source and destination color components are referred to as (Rs, Gs, Bs, As) and (Rd, Gd, Bd, Ad). The resultant color is referred to as (Rr, Gr, Br, Ar). Source and destination scale factors are referred to as (sR, sG, sB, sA) and (dR, dG, dB, dA). (See glBlendFunc for a description of the scale factors.) For these equations, all color components are understood to have integer values in the range [0,1].

GL_MIN_EXT
Each component of the the resultant color is the minimum of the corresponding component of the source and destination color. The source and destination blend factors are not used.

GL_MAX_EXT
Each component of the the resultant color is the maximum of the corresponding component of the source and destination color. The source and destination blend factors are not used.

GL_FUNC_ADD_EXT
Each component of the source color is multiplied by the source factor and added to the product of the destination color multiplied by the destination factor. The final component values are clamped to the range [0,1].

Rr = min(1, Rs sR + Rd dR)
Gr = min(1, Gs sG + Gd dG)
Br = min(1, Bs sB + Bd dB)
Ar = min(1, As sA + Ad dA)

GL_FUNC_SUBTRACT_EXT
Each component of the destination color is multiplied by the destination factor and subtracted from the product of the source color multiplied by the source factor. The final component values are clamped to the range [0,1].

Rr = MAX(0, Rs sR - Rd dR)
Gr = MAX(0, Gs sG - Gd dG)
Br = MAX(0, Bs sB - Bd dB)
Ar = MAX(0, As sA - Ad dA)

GL_FUNC_REVERSE_SUBTRACT_EXT
Each component of the source color is multiplied by the source factor and subtracted from the product of the destination color multiplied by the destination factor. The final component values are clamped to the range [0,1].

Rr = MAX(0, Rd dR - Rs sR)
Gr = MAX(0, Gd dG - Gs sG)
Br = MAX(0, Bd dB - Bs sB)
Ar = MAX(0, Ad dA - As sA)

NOTES

The GL_MIN_EXT and GL_MAX_EXT equations do not use the source or destination factors, only the source and destination colors.

When more than one color buffer is enabled for drawing, blending is done separately for each enabled buffer, using the contents of that buffer for destination color. (See glDrawBuffer.)

Blending affects only RGBA rendering. It is ignored by color index renderers.

EXTENSIONS

The following functions and/or constants are part of an extension, not part of the core GL command set. The extension name must be present in the string returned by glGetString when called with argument GL_EXTENSIONS.
GL_EXT_blend_minmax
glBlendEquationEXT, GL_FUNC_ADD_EXT, GL_MIN_EXT, GL_MAX_EXT, and GL_BLEND_EQUATION_EXT are part of the EXT_blend_minmax extension.

GL_EXT_blend_subtract
GL_FUNC_SUBTRACT_EXT and GL_FUNC_REVERSE_SUBTRACT_EXT are part of the EXT_blend_subtract extension.

ERRORS

GL_INVALID_ENUM is generated if mode is not an accepted value.

GL_INVALID_OPERATION is generated if glBlendEquationEXT is executed between the execution of glBegin and the corresponding execution of glEnd.

ASSOCIATED GETS

glGet with an argument of GL_BLEND_EQUATION_EXT

SEE ALSO

glBlendFunc, glDrawBuffer, glEnable, glGetString