Set

static void Set(
Blender blender );

Selects the specified blender as the active color blender.


static void Set(
GLenum sourceFactor, GLenum destFactor )

Selects a custom blender as the active color blender.

List of pre-defined blenders

ALPHA_BLENDER (the default blender)

Alpha values of the source pixels tell the opacity of the pixel. The higher the alpha value is, the more visible the pixel is. See more in Rgba.

Bitmaps are rendered with translucent pixels if they have an alpha channel.

The alpha value of Rgba colors tell the opacity of the primitive or text.


ADDITIVE_BLENDER

Renderind pixels increases the lightness of the underlying pixels. The alpha value tells the intensity of the lighting.

Bitmaps can be used as explosions and spotlights.

Primitives can be used to lit specific areas and glowing explosion particles.

Text can be used to produce lit text in dark background, like a glow in a computer screen.


SUBTRACTIVE_BLENDER

Renderind pixels decreases the lightness of the underlying pixels. The alpha value tells the intensity of the darkening.

Bitmaps can be used as shadows (though the same works usually with ALPHA_BLENDER). Primitives can be used to darken specific areas.


List of custom blender enumerations can be found in OpenGL documentation under glBlendFunc.

Examples

// Select the additive blender //
Blenders::Set( ADDITIVE_BLENDER );

// Select the alpha blender (used by default) //
Blenders::Set( ALPHA_BLENDER );

// Selects a custom blender which is like an inverted ALPHA_BLENDER: //
Blenders::Set( GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA );


Other functions of the class Blenders


Questions about Set? Click here.