Porting Blending Code

In IRIS GL, when drawing to both front and back buffers, blending is done by reading one of the buffers, blending with that color, and then writing the result to both buffers. In OpenGL, however, each buffer is read in turn, blended, and then written.

The following table lists IRIS GL blending functions and their equivalent OpenGL functions.

IRIS GL Function OpenGL Function Meaning
glEnable(GL_BLEND) Turn on blending.
blendfunction glBlendFunc Specify a blend function.

The OpenGL glBlendFunc function and the IRIS GL blendfunction function are almost identical. The following table lists IRIS GL blend factors and their OpenGL equivalents.

IRIS GL OpenGL Notes
BF_ZERO GL_ZERO
BF_ONE GL_ONE
BF_SA GL_SRC_ALPHA
BF_MSA GL_ONE_MINUS_SRC_ALPHA
BF_DA GL_DST_ALPHA
BF_MDA GL_ONE_MINUS_DST_ALPHA
BF_SC GL_SRC_COLOR
BF_MSC GL_ONE_MINUS_SRC_COLOR Destination only.
BF_DC GL_DST_COLOR Source only.
BF_MDC GL_ONE_MINUS_DST_COLOR Source only.
BF_MIN_SA_MDA GL_SRC_ALPHA_SATURATE