glBlendFunc Function

Syntax

GL_APICALL void GL_APIENTRY glBlendFunc(
     GLenum sfactor,
     GLenum dfactor
);

Parameters

Name Description
in sfactor Source blend factors for the blend feature
in dfactor Destination blend factors for the blend feature

Return Values

No values are returned.

Description

Configures the source and destination blend factors for the blend feature. The same values are set for the RGB and alpha components.

You can set sfactor and dfactor to the following values. (You cannot set dfactor to GL_SRC_ALPHA_SATURATE with POD.)

In the table, (Fr,Fg,Fb,Fa) indicates the blend factors for each RGBA component, (Rs,Gs,Bs,As) indicates the input pixel color, (Rd,Gd,Bd,Ad) indicates the pixel color stored in the framebuffer, and (Rc,Gc,Bc,Ac) indicates the constant color set by glBlendColor.

GL_ZERO(Fr,Fg,Fb,Fa) = (0,0,0,0)
GL_ONE(Fr,Fg,Fb,Fa) = (1,1,1,1)
GL_SRC_COLOR(Fr,Fg,Fb,Fa) = (Rs,Gs,Bs,As)
GL_ONE_MINUS_SRC_COLOR(Fr,Fg,Fb,Fa) = (1,1,1,1) - (Rs,Gs,Bs,As)
GL_DST_COLOR(Fr,Fg,Fb,Fa) = (Rd,Gd,Bd,Ad)
GL_ONE_MINUS_DST_COLOR(Fr,Fg,Fb,Fa) = (1,1,1,1) - (Rd,Gd,Bd,Ad)
GL_SRC_ALPHA(Fr,Fg,Fb,Fa) = (As,As,As,As)
GL_ONE_MINUS_SRC_ALPHA(Fr,Fg,Fb,Fa) = (1,1,1,1) - (As,As,As,As)
GL_DST_ALPHA(Fr,Fg,Fb,Fa) = (Ad,Ad,Ad,Ad)
GL_ONE_MINUS_DST_ALPHA(Fr,Fg,Fb,Fa) = (1,1,1,1) - (Ad,Ad,Ad,Ad)
GL_CONSTANT_COLOR(Fr,Fg,Fb,Fa) = (Rc,Gc,Bc,Ac)
GL_ONE_MINUS_CONSTANT_COLOR(Fr,Fg,Fb,Fa) = (1,1,1,1) - (Rc,Gc,Bc,Ac)
GL_CONSTANT_ALPHA(Fr,Fg,Fb,Fa) = (Ac,Ac,Ac,Ac)
GL_ONE_MINUS_CONSTANT_ALPHA(Fr,Fg,Fb,Fa) = (1,1,1,1) - (Ac,Ac,Ac,Ac)
GL_SRC_ALPHA_SATURATE(Fr,Fg,Fb,Fa) = (min(As,1-Ad),min(As,1-Ad),min(As,1-Ad),1)

This function generates the following errors.

GL_INVALID_OPERATIONThis function was called without any command-list objects bound.
GL_INVALID_ENUMThe sfactor or dfactor argument was set to an invalid value.

Revision History

2010/01/07
Initial version.

CONFIDENTIAL