mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Got rid of glBlendFuncSeparate which caused problems on old hardware -- need to find a proper fix for incorrect alpha values when rendering to a RenderImage
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1172 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
9c959777d3
commit
0f7cb43902
@ -46,8 +46,6 @@ myBlendMode (Blend::Alpha),
|
|||||||
myNeedUpdate (true),
|
myNeedUpdate (true),
|
||||||
myInvNeedUpdate(true)
|
myInvNeedUpdate(true)
|
||||||
{
|
{
|
||||||
// Make sure that GLEW is initialized (for glBlendFuncSeparate)
|
|
||||||
EnsureGlewInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -378,22 +376,14 @@ void Drawable::Draw(RenderTarget& target) const
|
|||||||
{
|
{
|
||||||
GLCheck(glEnable(GL_BLEND));
|
GLCheck(glEnable(GL_BLEND));
|
||||||
|
|
||||||
// We have to use glBlendFuncSeparate so that the resulting alpha is
|
// @todo the resulting alpha may not be correct, which matters when target is a RenderImage.
|
||||||
// not alpha², which is incorrect and would cause problems when rendering
|
// find a fix for this (glBlendFuncSeparate -- but not supported by every graphics card)
|
||||||
// alpha pixels to a RenderImage that would be in turn rendered to another render target
|
|
||||||
switch (myBlendMode)
|
switch (myBlendMode)
|
||||||
{
|
{
|
||||||
case Blend::Alpha :
|
case Blend::Alpha : GLCheck(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); break;
|
||||||
GLCheck(glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA));
|
case Blend::Add : GLCheck(glBlendFunc(GL_SRC_ALPHA, GL_ONE)); break;
|
||||||
break;
|
case Blend::Multiply : GLCheck(glBlendFunc(GL_DST_COLOR, GL_ZERO)); break;
|
||||||
case Blend::Add :
|
default : break;
|
||||||
GLCheck(glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ONE, GL_ONE_MINUS_SRC_ALPHA));
|
|
||||||
break;
|
|
||||||
case Blend::Multiply :
|
|
||||||
GLCheck(glBlendFuncSeparate(GL_DST_COLOR, GL_ZERO, GL_ONE, GL_ONE_MINUS_SRC_ALPHA));
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user