add BLEND_WEIGHTED_MULTIPLY and BLEND_INVERT_DEST blend modes

This commit is contained in:
Glenn Maynard
2006-07-27 01:34:57 +00:00
parent 79ebe8805d
commit 9ed6603349
3 changed files with 21 additions and 1 deletions
+18
View File
@@ -1416,6 +1416,14 @@ void RageDisplay_OGL::SetBlendMode( BlendMode mode )
{
glEnable(GL_BLEND);
if( GLExt.glBlendEquation != NULL )
{
if( mode == BLEND_INVERT_DEST )
GLExt.glBlendEquation( GL_FUNC_SUBTRACT );
else
GLExt.glBlendEquation( GL_FUNC_ADD );
}
switch( mode )
{
case BLEND_NORMAL:
@@ -1424,6 +1432,16 @@ void RageDisplay_OGL::SetBlendMode( BlendMode mode )
case BLEND_ADD:
glBlendFunc( GL_SRC_ALPHA, GL_ONE );
break;
case BLEND_WEIGHTED_MULTIPLY:
/* output = 2*(dst*src). 0.5,0.5,0.5 is identity; darker colors darken the image,
* and brighter colors lighten the image. */
glBlendFunc( GL_DST_COLOR, GL_SRC_COLOR );
break;
case BLEND_INVERT_DEST:
/* out = src - dst. The source color should almost always be #FFFFFF, to make it "1 - dst". */
glBlendFunc( GL_ONE, GL_ONE );
break;
case BLEND_NO_EFFECT:
/* XXX: Would it be faster and have the same effect to say glDisable(GL_COLOR_WRITEMASK)? */
glBlendFunc( GL_ZERO, GL_ONE );