commit 001fb991ae1353df22481a13cf1dbcb7b925682a
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue Jul 3 13:06:58 2018 +0100

    Largely fix the non-postprocessed OIT. Still, one problem remains: back-facing surfaces seem to disappear (visible in 'Cubes')

diff --git a/src/main/java/org/distorted/library/main/DistortedOutputSurface.java b/src/main/java/org/distorted/library/main/DistortedOutputSurface.java
index fd70e3b..fd05bab 100644
--- a/src/main/java/org/distorted/library/main/DistortedOutputSurface.java
+++ b/src/main/java/org/distorted/library/main/DistortedOutputSurface.java
@@ -388,19 +388,6 @@ public abstract class DistortedOutputSurface extends DistortedSurface implements
 // Otherwise, render to a buffer and on each change of Postprocessing Bucket, apply the postprocessing
 // to a whole buffer (lastQueue.postprocess) and merge it (this.oitBuild).
 
-/*
-int renderChildren1(long time, int numChildren, ArrayList<DistortedNode> children, int fbo, boolean oit)
-  {
-  oitClear(this);
-  setAsOutputFBO(time,fbo);
-  mChildren.get(0).drawOIT(time, this);
-  GLES31.glMemoryBarrier(GLES31.GL_SHADER_STORAGE_BARRIER_BIT | GLES31.GL_ATOMIC_COUNTER_BARRIER_BIT);
-  oitRender(time, fbo);
-
-  return 0;
-  }
-*/
-
   int renderChildren(long time, int numChildren, ArrayList<DistortedNode> children, int fbo, boolean oit)
     {
     int quality=0, internalQuality = 0, numRenders = 0, bucketChange = 0;
diff --git a/src/main/res/raw/main_fragment_shader.glsl b/src/main/res/raw/main_fragment_shader.glsl
index 52ad3dd..60b9953 100644
--- a/src/main/res/raw/main_fragment_shader.glsl
+++ b/src/main/res/raw/main_fragment_shader.glsl
@@ -126,21 +126,24 @@ void main()
     }
 #endif
 
+  vec4 converted = vec4(color.rgb * (1.0 + 7.0*v_Normal.z) * 0.125, color.a);
+
 #ifdef OIT
-  if( color.a > 0.95 )
+  if( converted.a > 0.95 )
     {
-    fragColor= vec4(color.rgb * (1.0 + 7.0*v_Normal.z) * 0.125, color.a);
+    fragColor= converted;
     }
   else
     {
-    if( color.a > 0.0 )
+    if( converted.a > 0.0 )
       {
       const float S= 2147483647.0; // max signed int. Could probably be max unsigned int but this is enough.
-      insert(v_Pixel, uint(S*(1.0-gl_FragCoord.z)/2.0), convert(color) );
+      vec2 pixel = vec2(gl_FragCoord.xy);
+      insert(pixel, uint(S*(1.0-gl_FragCoord.z)/2.0), convert(converted) );
       }
     discard;
     }
 #else
-  fragColor = vec4(color.rgb * (1.0 + 7.0*v_Normal.z) * 0.125, color.a);
+  fragColor = converted;
 #endif
   }
\ No newline at end of file
