GLBLENDEQUATION(3G)

πŸ“¦ version 24.3.3, in opensuse-leap 16.0

✨ 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 be GL_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_MIN sets 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_MAX sets 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 like GL_FUNC_ADD except 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 like GL_FUNC_ADD except 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_ENUM is generated if mode is not one of GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MAX, or GL_MIN.
  • GL_INVALID_OPERATION is generated if glBlendEquation is executed between the execution of glBegin and the corresponding execution of glEnd.
bestie, do not call this between glBegin and the matching glEnd β€” that is the GL_INVALID_OPERATION trap, 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