nCine::GLBlending class

Manages the OpenGL blending state.

Static wrapper that caches the current blending state (GL_BLEND enable flag and the glBlendFunc/glBlendFuncSeparate factors) so that redundant OpenGL calls are skipped when the requested state matches the cached one.

Public types

struct State
Holds the cached blending state.

Public static functions

static auto IsEnabled() -> bool
Returns whether blending is enabled.
static void Enable()
Enables blending.
static void Disable()
Disables blending.
static void SetBlendFunc(GLenum sfactor, GLenum dfactor)
Sets the same source and destination blend factors for both RGB and alpha.
static void SetBlendFunc(GLenum srcRgb, GLenum dstRgb, GLenum srcAlpha, GLenum dstAlpha)
Sets separate source and destination blend factors for RGB and alpha.
static auto GetState() -> State
Returns the whole cached blending state.
static void SetState(State newState)
Restores the whole blending state.

Constructors, destructors, conversion operators

GLBlending() deleted
~GLBlending() deleted

Function documentation

static void nCine::GLBlending::SetBlendFunc(GLenum sfactor, GLenum dfactor)

Sets the same source and destination blend factors for both RGB and alpha.

Parameters
sfactor Source blend factor for RGB and alpha
dfactor Destination blend factor for RGB and alpha

static void nCine::GLBlending::SetBlendFunc(GLenum srcRgb, GLenum dstRgb, GLenum srcAlpha, GLenum dstAlpha)

Sets separate source and destination blend factors for RGB and alpha.

Parameters
srcRgb Source blend factor for RGB
dstRgb Destination blend factor for RGB
srcAlpha Source blend factor for alpha
dstAlpha Destination blend factor for alpha