![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Core/GL/Blending.h>
Helper class to configure the OpenGL blending stage. More...
Helper class to configure the OpenGL blending stage.
The OpenGL blending stage defines how a new pixel ("source") is combined with an already existing pixel in the framebuffer ("destination") in order to yield the final pixel value. OpenGL splits this configuration in multiple parts:
Usage Example:
Public Types | |
enum class | Preset { Disabled , AlphaBlending } |
Enumeration of commonly used blending modes. More... | |
enum class | Equation { FuncAdd = 0x8006 , FuncSubstract = 0x800A , FuncReverseSubstract = 0x800B , Min = 0x8007 , Max = 0x8008 } |
Enumeration to define how source and destination blending component are combined to yield the output pixel value. More... | |
enum class | Function { Zero = 0 , One = 1 , SrcColor = 0x0300 , OneMinusSrcColor = 0x0301 , SrcAlpha = 0x0302 , OneMinusSrcAlpha = 0x0303 , DstColor = 0x0306 , OneMinusDstColor = 0x0307 , DstAlpha = 0x0304 , OneMinusDstAlpha = 0x0305 , ConstantColor = 0x8001 , OneMinusConstantColor = 0x8002 , ConstantAlpha = 0x8003 , OneMinusConstantAlpha = 0x8004 } |
Enumeration to define how a blending component (source/destination) should be computed. More... | |
Public Member Functions | |
Blending (Preset preset) | |
Sets up OpenGL blending based on the given preset. | |
Blending (Function sourceFunc, Function destinationFunc) | |
Enables OpenGL blending and sets the blend function as defined. | |
Blending (Function sourceFuncRGB, Function destinationFuncRGB, Function sourceAlpha, Function destinationAlpha) | |
Enables OpenGL blending and sets the blend function as defined. | |
Blending (Blending &&rhs) noexcept | |
Blending & | operator= (Blending &&rhs) noexcept |
~Blending () | |
Restores the original OpenGL blending state of when this instance was created. | |
void | setBlendingEnabled (bool isEnabled) |
Enables or disables the OpenGL blending stage. | |
void | setPreset (Preset preset) |
Sets up OpenGL blending based on the given preset. | |
void | setFunction (Function sourceFunc, Function destinationFunc) |
Defines the arithmetic how source and destination blending factors are computed uniformly for all RGBA channels. | |
void | setFunction (Function sourceFuncRGB, Function destinationFuncRGB, Function sourceAlpha, Function destinationAlpha) |
Defines the arithmetic how source and destination blending factors are computed and allows for different functions for color and alpha channels. | |
void | setEquation (Equation blendEquation) |
Defines how the new pixel is combined with the pixel already in the framebuffer, uniformly for all RGBA channels. | |
void | setEquation (Equation blendEquationRGB, Equation blendEquationAlpha) |
Defines how the new pixel is combined with the pixel already in the framebuffer, allowing for different equations for color and alpha channels. | |
void | setBlendColor (vec4f blendColor) |
Defines the reference color used when choosing one of the Constant blend functions. | |
|
strong |
Enumeration of commonly used blending modes.
Enumerator | |
---|---|
Disabled | Disables blending, new pixels will completely replace/overwrite existing pixels. |
AlphaBlending | Enables blending and sets (Function::SrcAlpha, Function::OneMinusSrcAlpha, Function::One, Function::OneMinusSrcAlpha) as blend function. |
|
strong |
Enumeration to define how source and destination blending component are combined to yield the output pixel value.
|
strong |
Enumeration to define how a blending component (source/destination) should be computed.