commit 2ed1c6926e91c416f8e11e70d86ca3cd2f100a0a
Author: leszek <leszek@koltunski.pl>
Date:   Tue Feb 21 22:10:50 2017 +0000

    1) stop culling back face
    2) reset OpenGL state beore each render (and not in onCreate)
    3) Improve Matrix3D so that we can test negative Scales

diff --git a/src/main/java/org/distorted/library/Distorted.java b/src/main/java/org/distorted/library/Distorted.java
index 6a3cb34..330242e 100644
--- a/src/main/java/org/distorted/library/Distorted.java
+++ b/src/main/java/org/distorted/library/Distorted.java
@@ -105,17 +105,8 @@ public class Distorted
   throws FragmentCompilationException,VertexCompilationException,VertexUniformsException,FragmentUniformsException,LinkingException
     {
     final Resources resources = context.getResources();
-
-    GLES30.glDepthFunc(GLES30.GL_LEQUAL);
-    GLES30.glEnable(GLES30.GL_BLEND);
-    GLES30.glBlendFunc(GLES30.GL_SRC_ALPHA, GLES30.GL_ONE_MINUS_SRC_ALPHA);
-    GLES30.glEnable(GLES30.GL_CULL_FACE);
-    GLES30.glCullFace(GLES30.GL_BACK);
-    GLES30.glFrontFace(GLES30.GL_CW);
-
     DistortedEffects.createProgram(resources);
     EffectQueuePostprocess.createProgram(resources);
-
     EffectMessageSender.startSending();
 
     mInitialized = true;
diff --git a/src/main/java/org/distorted/library/DistortedFramebuffer.java b/src/main/java/org/distorted/library/DistortedFramebuffer.java
index 6671a06..5ded4fa 100644
--- a/src/main/java/org/distorted/library/DistortedFramebuffer.java
+++ b/src/main/java/org/distorted/library/DistortedFramebuffer.java
@@ -26,7 +26,7 @@ import android.opengl.GLES30;
  * Class which represents a OpenGL Framebuffer object.
  * <p>
  * User is able to create offscreen FBOs and both a) render to them b) use their COLOR0 attachment as
- * an input texture.
+ * an input texture. Attaching Depths and/or Stencils is also possible.
  */
 public class DistortedFramebuffer extends DistortedOutputSurface implements DistortedInputSurface
   {
diff --git a/src/main/java/org/distorted/library/DistortedOutputSurface.java b/src/main/java/org/distorted/library/DistortedOutputSurface.java
index dc7824f..5eba125 100644
--- a/src/main/java/org/distorted/library/DistortedOutputSurface.java
+++ b/src/main/java/org/distorted/library/DistortedOutputSurface.java
@@ -143,6 +143,11 @@ abstract class DistortedOutputSurface extends DistortedSurface implements Distor
       DistortedSurface.debugLists();
       }
 */
+    GLES30.glDepthFunc(GLES30.GL_LEQUAL);
+    GLES30.glEnable(GLES30.GL_BLEND);
+    GLES30.glBlendFunc(GLES30.GL_SRC_ALPHA, GLES30.GL_ONE_MINUS_SRC_ALPHA);
+    GLES30.glDisable(GLES30.GL_CULL_FACE);
+
     int numRenders = 0;
 
     for(int i=0; i<mNumChildren; i++)
