Up
About blends :
Currentrly there is no blend mode to make sprite brighter (Color -> White, only Color -> Black).
With blend mode BlendAlpha and White color, we can see sprite as it suppose to be (Color), if we change the color to black, sprite will become dim. But if we want it to change from Color to White, we can't.
I modified the function that set blend state :
void RenderTarget::applyBlendMode(BlendMode mode)
{
switch (mode)
{
// Alpha blending
// glBlendFuncSeparateEXT is used when available to avoid an incorrect alpha value when the target
// is a RenderTexture -- in this case the alpha value must be written directly to the target buffer
default :
case BlendAlpha :
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
if (GLEW_EXT_blend_func_separate)
glCheck(glBlendFuncSeparateEXT(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA));
else
glCheck(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
break;
// Additive blending
case BlendAdd :
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glCheck(glBlendFunc(GL_SRC_ALPHA, GL_ONE));
break;
// Multiplicative blending
case BlendMultiply :
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glCheck(glBlendFunc(GL_DST_COLOR, GL_ZERO));
break;
// No blending
case BlendNone :
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glCheck(glBlendFunc(GL_ONE, GL_ZERO));
break;
// BlendAlphaAdd
case BlendAlphaAdd :
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
glCheck(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
break;
}
m_cache.lastBlendMode = mode;
}
now you can use new mode to highlight sprite
BlendAlpha + White == BlendAlphaAdd + Black
BlendAlpha + Black = Black Sprite
BlendAlphaAdd + White = White Sprite
with this combination you can highlight or dim sprites