From 3fc1a362017c24cb99c44b6953847fc43989b984 Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Sat, 5 May 2012 00:10:56 +0200 Subject: [PATCH] Fix a shader problem. It seems a bad idea to set gl_FragData in a conditional block. It seems better to assign a value unconditionally even if there is no buffer attached. --- Shaders/gbuffer-encode.frag | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Shaders/gbuffer-encode.frag b/Shaders/gbuffer-encode.frag index 931f959f3..a3ced2d89 100644 --- a/Shaders/gbuffer-encode.frag +++ b/Shaders/gbuffer-encode.frag @@ -17,6 +17,8 @@ void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shin gl_FragData[0] = vec4( normal_encode(normal), 0.0, 1.0 ); gl_FragData[1] = vec4( color, float( mId ) / 255.0 ); gl_FragData[2] = vec4( specular, shininess / 128.0, emission, 1.0 ); + vec3 dcol = vec3(1.0, 1.0, 1.0); if (fg_DepthInColor) - gl_FragData[3] = vec4(float_to_color(depth), 1.0); + dcol = float_to_color(depth); + gl_FragData[3] = vec4(dcol, 1.0); }