GLBLENDEQUATION(3G)
β¨ NAME β¨
okay bestie, this is the GLBLENDEQUATION(3G) page β the manual for glBlendEquation, and its whole job is literally: set the blend equation π
πΈ C SPECIFICATION πΈ
the C signature is giving exactly this:
void glBlendEquation( GLenum mode )
π PARAMETERS π
modeβ specifies how source and destination colors are combined. It must beGL_FUNC_ADD,GL_FUNC_SUBTRACT,GL_FUNC_REVERSE_SUBTRACT,GL_MIN,GL_MAX.
π¦ DESCRIPTION π¦
the blend equation is the vibe check for how a new pixel (the source color) gets combined with a pixel already in the framebuffer (the destination color). no cap.
GL_MINsets the blend equation so that each component of the result color is the minimum of the corresponding components of the source and destination colors.GL_MAXsets the blend equation so that each component of the result color is the maximum of the corresponding components of the source and destination colors.
the remaining blend equations use the source and destination blend factors specified by glBlendFunc. see glBlendFunc for a description of the various blend factors.
in the equations that follow, source and destination color components are referred to as (Rs,Gs,Bs,As) and (Rd,Gd,Bd,Ad), respectively. the result color is referred to as (Rr,Gr,Br,Ar). the source and destination blend factors are denoted (sR,sG,sB,sA) and (dR,dG,dB,dA), respectively. for these equations all color components are understood to have values in the range [0, 1].
GL_FUNC_ADDβ sets the blend equation so that the source and destination data are added. each component of the source color is multiplied by the corresponding source factor, then each component of the destination color is multiplied by the corresponding destination factor. the result is the componentwise sum of the two products, clamped to the range[0, 1].
Rr=min(1,RssR+RddR)
Gr=min(1,GssG+GddG)
Br=min(1,BssB+BddB)
Ar=min(1,AssA+AddA)
GL_FUNC_SUBTRACTβ is likeGL_FUNC_ADDexcept the product of the destination factor and the destination color is componentwise subtracted from the product of the source factor and the source color. the result is clamped to the range[0, 1].
Rr=max(0,RssRβRddR)
Gr=max(0,GssGβGddG)
Br=max(0,BssBβBddB)
Ar=max(0,AssAβAddA)
GL_FUNC_REVERSE_SUBTRACTβ is likeGL_FUNC_ADDexcept the product of the source factor and the source color is componentwise subtracted from the product of the destination factor and the destination color. the result is clamped to the range[0, 1].
Rr=max(0,RddRβRssR)
Gr=max(0,GddGβGssG)
Br=max(0,BddBβBssB)
Ar=max(0,AddAβAssA)
the GL_MIN and GL_MAX equations are useful for applications that analyze image data (image thresholding against a constant color, for example). the GL_FUNC_ADD equation is useful for antialiasing and transparency, among other things.
initially, the blend equation is set to GL_FUNC_ADD. iconic default behavior, honestly β¨
π NOTES π
glBlendEquation is part of the GL_ARB_imaging subset. glBlendEquation is present only if GL_ARB_imaging is returned when glGetString is called with GL_EXTENSIONS as its argument.
the GL_MIN, and GL_MAX equations do not use the source or destination factors, only the source and destination colors.
π ERRORS π
GL_INVALID_ENUMis generated ifmodeis not one ofGL_FUNC_ADD,GL_FUNC_SUBTRACT,GL_FUNC_REVERSE_SUBTRACT,GL_MAX, orGL_MIN.GL_INVALID_OPERATIONis generated ifglBlendEquationis executed between the execution ofglBeginand the corresponding execution ofglEnd.
bestie, do not call this betweenglBeginand the matchingglEndβ that is theGL_INVALID_OPERATIONtrap, and it is not the vibe π
π ASSOCIATED GETS π
glGet with an argument of GL_BLEND_EQUATION
π SEE ALSO π
glGetString(3G)glBlendColor(3G)glBlendFunc(3G)
cute sign-off: this page lives under GLBLENDEQUATION(3G) at the bottom, so that's the source/version tag, bestie β this copy doesn't show an extra date line, just iconic manual energy ππ
π¦ where this page comes from
- opensuse-leap 16.0: Mesa-libGL-devel 24.1.7-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms