Set

static void Set(
Blender blender );

Selects a pre-defined blender as the active color blender.


static void Set(
GLenum sourceFactor, GLenum destFactor )

Selects a custom blender as the active color blender.

A list of the 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 darkening always happens with a full intensity.

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


COPY_BLENDER

The alpha channel is discarted and the pixels are simply copied from the source to the destination. In other words, blending is disabled.


FULL_ADDITIVE_BLENDER

Like ADDITIVE_BLENDER and COPY_BLENDER combined - discards the alpha channel and adds the pixels from the source to the destination with full intensity.


A 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
Set
Selects the specified blender as the active color blender

Advanced functions

Push
Pushes the active blender to the stack
Pop
Pops the most recently stored blender from the stack


Questions about Set? Click here.