From 224645d1071c14b4829dbb3ae35870868fcff85a Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 13 Feb 2018 23:00:10 -0500 Subject: Fixed inconsistent rendering failure The issue appears to have been caused by blending with unset alpha channels. Also included the re-ordered player character sprite image. The CMake file has been updated to include linking against some Apple libraries that are usually already included in GLFW3. refs #1 --- shaders/bloom2.fragment | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'shaders/bloom2.fragment') diff --git a/shaders/bloom2.fragment b/shaders/bloom2.fragment index 4c50e86..6723c2c 100644 --- a/shaders/bloom2.fragment +++ b/shaders/bloom2.fragment @@ -2,7 +2,7 @@ in vec2 UV; -out vec3 color; +out vec4 color; uniform sampler2D clearTex; uniform sampler2D blurTex; @@ -15,19 +15,21 @@ float nrand(vec2 n) void main() { - color = vec3(0.0); - color += texture(clearTex, UV).rgb / 2.0; - color += texture(blurTex, UV).rgb; - color = max(vec3(0.0), color - 0.5); - color *= color; - + vec3 mval = vec3(0.0); + mval += texture(clearTex, UV).rgb / 2.0; + mval += texture(blurTex, UV).rgb; + mval = max(vec3(0.0), mval - 0.5); + mval *= mval; + float flicker = 0.5 + nrand(vec2(iGlobalTime)); flicker *= (flicker); //flicker = sqrt(flicker); //flicker = pow(flicker, 1.0/8.0); - //color *= flicker; - color *= mix(vec3(0.0), color, flicker); - - color += texture(clearTex, UV).rgb; - color = clamp(color, vec3(0.0), vec3(1.0)); + //mval *= flicker; + mval *= mix(vec3(0.0), mval, flicker); + + mval += texture(clearTex, UV).rgb; + mval = clamp(mval, vec3(0.0), vec3(1.0)); + + color = vec4(mval, 1.0); } -- cgit 1.4.1