From 38da3f4338e3b2b11e3dff2726a62104cf27fa73 Mon Sep 17 00:00:00 2001 From: Laurent Gomila Date: Thu, 3 Jan 2013 20:34:51 +0100 Subject: [PATCH] Fixed computation of the alpha channel in sf::BlendAdd --- src/SFML/Graphics/RenderTarget.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp index a5af0ad9a..860b8a490 100644 --- a/src/SFML/Graphics/RenderTarget.cpp +++ b/src/SFML/Graphics/RenderTarget.cpp @@ -344,9 +344,10 @@ 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 + + // Alpha blending default : case BlendAlpha : if (GLEW_EXT_blend_func_separate) @@ -357,7 +358,10 @@ void RenderTarget::applyBlendMode(BlendMode mode) // Additive blending case BlendAdd : - glCheck(glBlendFunc(GL_SRC_ALPHA, GL_ONE)); + if (GLEW_EXT_blend_func_separate) + glCheck(glBlendFuncSeparateEXT(GL_SRC_ALPHA, GL_ONE, GL_ONE, GL_ONE)); + else + glCheck(glBlendFunc(GL_SRC_ALPHA, GL_ONE)); break; // Multiplicative blending