Fix wrong alpha channel for OpenGL render results with transparent textures or
materials, the typical glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); blend function does not give correct destination alpha.
This commit is contained in:
@@ -395,7 +395,12 @@ static void gpu_set_alpha_blend(GPUBlendMode alphablend)
|
||||
}
|
||||
else if (ELEM(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ALPHA_SORT)) {
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
/* for OpenGL render we use the alpha channel, this makes alpha blend correct */
|
||||
if (GLEW_VERSION_1_4)
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
else
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
/* if U.glalphaclip == 1.0, some cards go bonkers...
|
||||
* turn off alpha test in this case */
|
||||
|
Reference in New Issue
Block a user