Added subtractive and multiplicative blend modes (thanks vrld)

This commit is contained in:
Bart van Strien
2010-08-28 17:27:35 +02:00
parent 4bfd5a905b
commit 9ba06d65f6
3 changed files with 34 additions and 21 deletions
+12 -3
View File
@@ -533,10 +533,19 @@ namespace opengl
void Graphics::setBlendMode( Graphics::BlendMode mode )
{
if(mode == BLEND_ADDITIVE)
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
else // mode == BLEND_ALPHA
glAlphaFunc(GL_GEQUAL, 0);
if (mode == BLEND_SUBTRACTIVE)
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
else
glBlendEquation(GL_FUNC_ADD);
if (mode == BLEND_ALPHA)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
else if (mode == BLEND_MULTIPLICATIVE)
glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);
else
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
}
void Graphics::setColorMode ( Graphics::ColorMode mode )