I first draw the light and than render the diffuse on top of it and modulate it. The alpha channel of the diffuse render contains the mask for the glow so I try to preserve it with glBlendFuncSeparate but it doesn't seem to work. I know the alpha channel is good as I can change the blend of the diffuse to do an alpha test and the correct parts are transparent. When I use it on the glow, it does not work.
// ** draw lightmap here **
glEnable( GL_BLEND );
// take the color of the lightmap and multiple it by the diffuse
// destroy previous alpha while maintaining source's
glBlendFuncSeparate( GL_SRC_COLOR, GL_ZERO, GL_ONE, GL_ZERO );
// ** draw diffuse here **
glDisable( GL_BLEND );
glEnable( GL_BLEND );
// mask using diffuse's alpha while keeping colors intact
glBlend( GL_DST_ALPHA, GL_ONE );
// ** draw glow here **
glDisable( GL_BLEND );
I know that glBlendFunctSeparate might be the cause of the error but the syntax looks good, if I change the diffuse blend to
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA )
so I know the alpha is good but still for some reason it is reset to 1 when I do the glow draw.Thanks for any help !