From 535d547b80596cce33339753c24d3d7d53f11e01 Mon Sep 17 00:00:00 2001 From: Mai Lavelle Date: Sat, 2 Apr 2016 01:29:21 -0400 Subject: [PATCH] Fix division by zero error in shader --- extension.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extension.js b/extension.js index 4e4d6c5..da24964 100644 --- a/extension.js +++ b/extension.js @@ -37,7 +37,9 @@ const InvertWindowEffect = new Lang.Class({ uniform sampler2D tex; \ void main() { \ vec4 color = texture2D(tex, cogl_tex_coord_in[0].st); \ - color.rgb /= color.a; \ + if(color.a > 0.0) { \ + color.rgb /= color.a; \ + } \ color.rgb = vec3(1.0, 1.0, 1.0) - color.rgb; \ color.rgb *= color.a; \ cogl_color_out = color * cogl_color_in; \