blending combines the colour of the current primitive with the colour already
in the frame buffer.
colour value already stored in the frame buffer is the destination colour (Cd)
colour value that is coming into the frame buffer is the source colour (Cs)
default, the blending equation is
the blending equation, s
blending factors, that describe how much of the source and destination colours
to use when producing the blended result.
OpenGL, the blending factors are enumerants, not direct values. The blending factors are set with glBlendFunc (GLenum s, GLenum d);
are many possible values s
and d can
take. Some of the common ones include
the most common blending function is
tells OpenGL to take the source colour and multiply it by the source alpha
value. The destination colour is
multiplied by one minus the source alpha.
The result is the sum of these two terms.
blending function is often used to render a transparent object in front of an
opaque object. To get the desired
the opaque objects first before drawing the transparent ones
you’re rendering back-facing polygons, it may be necessary to draw the
transparent polygons far to near after depth sorting the polygons (based on
distance to the camera). This is called
the painter’s algorithm.
use glEnable(GL_CULL_FACE) to eliminate back-facing triangles.