commit 977756d745bf1f31ef10c7d85753e44d3bc1f50b
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Fri Dec 14 13:18:37 2018 +0000

    Fix the bug where the postprocessed GLOW halo of a Cube would be of different colors depending on the order of rendring of the cube sides. (one needed to switch off BLENDing while preprocessing )

diff --git a/src/main/java/org/distorted/library/main/DistortedRenderState.java b/src/main/java/org/distorted/library/main/DistortedRenderState.java
index dde55ea..3baee55 100644
--- a/src/main/java/org/distorted/library/main/DistortedRenderState.java
+++ b/src/main/java/org/distorted/library/main/DistortedRenderState.java
@@ -184,6 +184,38 @@ public class DistortedRenderState
       }
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  static void disableBlending()
+    {
+    sState.blend = cState.blend;
+
+    if (cState.blend != 0)
+      {
+      cState.blend = 0;
+      GLES31.glDisable(GLES31.GL_BLEND);
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  static void restoreBlending()
+    {
+    if (sState.blend != cState.blend)
+      {
+      cState.blend = sState.blend;
+
+      if (cState.blend == 0)
+        {
+        GLES31.glDisable(GLES31.GL_BLEND);
+        }
+      else
+        {
+        GLES31.glEnable(GLES31.GL_BLEND);
+        }
+      }
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   static void enableDepthTest()
diff --git a/src/main/java/org/distorted/library/main/EffectQueuePostprocess.java b/src/main/java/org/distorted/library/main/EffectQueuePostprocess.java
index 29a01c6..c88c009 100644
--- a/src/main/java/org/distorted/library/main/EffectQueuePostprocess.java
+++ b/src/main/java/org/distorted/library/main/EffectQueuePostprocess.java
@@ -170,6 +170,7 @@ class EffectQueuePostprocess extends EffectQueue
       float halfZ = halfW*mesh.getZFactor();
 
       DistortedRenderState.setUpStencilMark(mA!=0.0f);
+      DistortedRenderState.disableBlending();
 
       GLES31.glViewport(0, 0, buffer.mWidth, buffer.mHeight );
 
@@ -187,6 +188,7 @@ class EffectQueuePostprocess extends EffectQueue
 
       GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, mesh.getNumVertices() );
 
+      DistortedRenderState.restoreBlending();
       DistortedRenderState.unsetUpStencilMark();
 
       return 1;
