commit 78e89fb5973bc024639249f4ca9b493e9116069d
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Thu May 3 16:10:46 2018 +0100

    Properly recreate the Atomic and LinkedList buffers onPause.
    We have to discard all alpha==0.0 pixels during OIT Pass1.

diff --git a/src/main/java/org/distorted/library/main/Distorted.java b/src/main/java/org/distorted/library/main/Distorted.java
index 6afde6d..3769688 100644
--- a/src/main/java/org/distorted/library/main/Distorted.java
+++ b/src/main/java/org/distorted/library/main/Distorted.java
@@ -133,13 +133,14 @@ public class Distorted
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
- * Call this so that the Library can release its internal data structures.
+ * Call this so that the Library can release the OpenGL related data that needs to be recreated.
  * Must be called from Activity.onPause().
  */
   public static void onPause()
     {
     DistortedObject.onPause();
     DistortedNode.onPause();
+    DistortedEffects.onPause();
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/library/main/DistortedEffects.java b/src/main/java/org/distorted/library/main/DistortedEffects.java
index 3ea6a0f..aa7d379 100644
--- a/src/main/java/org/distorted/library/main/DistortedEffects.java
+++ b/src/main/java/org/distorted/library/main/DistortedEffects.java
@@ -506,13 +506,19 @@ public class DistortedEffects
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  static void onDestroy()
+  static void onPause()
     {
-    mNextID           =  0;
     mLinkedListSSBO[0]= -1;
     mAtomicCounter[0] = -1;
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  static void onDestroy()
+    {
+    mNextID =  0;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // PUBLIC API
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/res/raw/blit_depth_fragment_shader.glsl b/src/main/res/raw/blit_depth_fragment_shader.glsl
index 7d10844..3397874 100644
--- a/src/main/res/raw/blit_depth_fragment_shader.glsl
+++ b/src/main/res/raw/blit_depth_fragment_shader.glsl
@@ -123,4 +123,5 @@ void main()
     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-depth)/2.0), convert(frag) );
     }
+  else discard;
   }
\ No newline at end of file
diff --git a/src/main/res/raw/blit_depth_render_fragment_shader.glsl b/src/main/res/raw/blit_depth_render_fragment_shader.glsl
index 3d07385..70cbfef 100644
--- a/src/main/res/raw/blit_depth_render_fragment_shader.glsl
+++ b/src/main/res/raw/blit_depth_render_fragment_shader.glsl
@@ -64,12 +64,12 @@ void main()
     {
     u_Records[index] = 0u;
 
-    vec4 color= vec4(0.0,0.0,1.0,1.0);//convert(u_Records[curr+2u]);
+    vec4 color= convert(u_Records[curr+2u]);
     curr = u_Records[curr];
 
     while (curr > 0u)
       {
-      color= vec4(0.0,0.0,0.0,1.0);//blend( color, convert(u_Records[curr+2u]) );  // keep walking the linked list
+      color= blend( color, convert(u_Records[curr+2u]) );  // keep walking the linked list
       curr = u_Records[curr];                              // and blending the colors in
       }
 
