From af4a8eb92cd3cd061c60f0ce1f648636ad0cdce8 Mon Sep 17 00:00:00 2001 From: Tommy X Date: Tue, 14 Apr 2015 16:32:01 -0400 Subject: [PATCH] Improve default alpha blending Change default alpha blending blendFunc to correctly blend alpha for RGBA textures in non-premultiplied alpha mode --- legacy/project/src/opengl/OpenGLContext.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/legacy/project/src/opengl/OpenGLContext.cpp b/legacy/project/src/opengl/OpenGLContext.cpp index 65d15d92b..a204d7610 100644 --- a/legacy/project/src/opengl/OpenGLContext.cpp +++ b/legacy/project/src/opengl/OpenGLContext.cpp @@ -496,7 +496,12 @@ public: glBlendEquation( GL_FUNC_REVERSE_SUBTRACT); break; default: - glBlendFunc(premAlpha ? GL_ONE : GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + if (premAlpha){ + glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA); + } + else { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } glBlendEquation( GL_FUNC_ADD); }