commit ff8ad0a7cd8ac5c55f3bf0400c95cb98e441a1af
Author: Leszek Koltunski <leszek@distorted.org>
Date:   Thu Jul 21 00:11:28 2016 +0100

    Fix for Bug #16: When rotated at an angle, surfaces get increasingly transparent.
    
    This also fixes the saturation, chroma, alpha + contrast effects, while completely breaking macroblocks :)

diff --git a/src/main/res/raw/main_fragment_shader.glsl b/src/main/res/raw/main_fragment_shader.glsl
index 1690718..cf6db7c 100644
--- a/src/main/res/raw/main_fragment_shader.glsl
+++ b/src/main/res/raw/main_fragment_shader.glsl
@@ -92,7 +92,7 @@ void saturation(float degree, int effect, inout vec4 color)
 void main()                    		
   {  
   vec2 tex = v_TexCoordinate;
-  vec4 col = vec4(1.0,1.0,1.0,1.0);
+  vec4 col = texture2D(u_Texture, tex);
 
 #if NUM_FRAGMENT>0
   vec2 diff;
@@ -116,6 +116,6 @@ void main()
     else if( fType[i]==SMOOTH_SATURATION ) saturation(     pointDegree ,2*i,col);
     }
 #endif
- 
-  gl_FragColor = (col * 0.5 * (v_Normal.z+1.0) * texture2D(u_Texture, tex));
+
+  gl_FragColor = vec4(col.rgb * 0.5 * (v_Normal.z+1.0), col.a);
   }
\ No newline at end of file
diff --git a/src/main/res/raw/main_vertex_shader.glsl b/src/main/res/raw/main_vertex_shader.glsl
index ec6ef9d..334dd93 100644
--- a/src/main/res/raw/main_vertex_shader.glsl
+++ b/src/main/res/raw/main_vertex_shader.glsl
@@ -87,7 +87,7 @@ float degree_bitmap(in vec2 S, in vec2 PS)
 // Otherwise, let X be the point where the halfline SP meets the region circle - return |PX|/||SX|,
 // aka the 'degree' of point P.
 //
-// We solve the the triangle OPX.
+// We solve the triangle OPX.
 // We know the lengths |PO|, |OX| and the angle OPX, because cos(OPX) = cos(180-OPS) = -cos(OPS) = -PS*PO/(|PS|*|PO|)
 // then from the law of cosines PX^2 + PO^2 - 2*PX*PO*cos(OPX) = OX^2 so PX = -a + sqrt(a^2 + OX^2 - PO^2)
 // where a = PS*PO/|PS| but we are really looking for d = |PX|/(|PX|+|PS|) = 1/(1+ (|PS|/|PX|) ) and
@@ -319,10 +319,10 @@ void sink(in int effect,inout vec4 v)
 // This effect rotates the current vertex V by vInterpolated.x radians clockwise around the circle dilated 
 // by (1-d) around the center of the effect S.
 
-void swirl(in int effect, inout vec4 P)
+void swirl(in int effect, inout vec4 v)
   {
   vec2 S  = vUniforms[effect+2].yz;
-  vec2 PS = S-P.xy;
+  vec2 PS = S-v.xy;
   vec3 SO = vUniforms[effect+1];
   float d1_circle = degree_region(SO,PS);
   float d1_bitmap = degree_bitmap(S,PS);
@@ -332,7 +332,7 @@ void swirl(in int effect, inout vec4 P)
   vec3 SG = (1.0-d1_circle)*SO;                                // coordinates of the dilated circle P is going to get rotated around
   float d2 = max(0.0,degree(SG,S,PS2));                        // make it a max(0,deg) because when S=left edge of the bitmap, otherwise
                                                                // some points end up with d2<0 and they disappear off view.
-  P.xy += min(d1_circle,d1_bitmap)*(PS - PS2/(1.0-d2));        // if d2=1 (i.e P=S) we should have P unchanged. How to do it?
+  v.xy += min(d1_circle,d1_bitmap)*(PS - PS2/(1.0-d2));        // if d2=1 (i.e P=S) we should have P unchanged. How to do it?
   }
 
 #endif
