commit d03782c09488d75e9870df3411e65ec215f95826
Author: leszek <leszek@koltunski.pl>
Date:   Wed Feb 15 17:45:28 2017 +0000

    fix for the first issue uncovered by the new Olimpic.

diff --git a/src/main/java/org/distorted/library/DistortedNode.java b/src/main/java/org/distorted/library/DistortedNode.java
index 4ac65ab..29488f1 100644
--- a/src/main/java/org/distorted/library/DistortedNode.java
+++ b/src/main/java/org/distorted/library/DistortedNode.java
@@ -201,44 +201,41 @@ public class DistortedNode implements DistortedAttacheable
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // return the total number of render calls issued
 
-  int drawRecursive(int render, long currTime, DistortedOutputSurface surface)
+  int drawRecursive(int renderNum, long currTime, DistortedOutputSurface surface)
     {
     int ret = 0;
     float halfX = mSurface.getWidth()/2.0f;
     float halfY = mSurface.getHeight()/2.0f;
 
-    if( mNumChildren[0]<=0 )
+    if( mNumChildren[0]>0 && mData.numRender!=renderNum )
       {
-      mSurface.setAsInput();
-      }
-    else
-      {
-      if( mData.numRender!=render )
-        {
-        mData.numRender = render;
-        mData.mFBO.setAsOutput();
+      mData.numRender = renderNum;
+      mData.mFBO.setAsOutput();
 
-        GLES30.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-        GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT);
+      GLES30.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+      GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT);
 
-        if( mSurface.setAsInput() )
-          {
-          ret++;
-          DistortedEffects.drawNoEffectsPriv(halfX, halfY, mMesh, mData.mFBO);
-          }
-
-        for(int i=0; i<mNumChildren[0]; i++)
-          {
-          ret += mChildren.get(i).drawRecursive(render, currTime, mData.mFBO);
-          }
+      if( mSurface.setAsInput() )
+        {
+        ret++;
+        DistortedEffects.drawNoEffectsPriv(halfX, halfY, mMesh, mData.mFBO);
         }
 
-      mData.mFBO.setAsInput();
+      for(int i=0; i<mNumChildren[0]; i++)
+        {
+        ret += mChildren.get(i).drawRecursive(renderNum, currTime, mData.mFBO);
+        }
       }
 
-    mEffects.drawPriv(halfX, halfY, mMesh, surface, currTime);
+    DistortedInputSurface input = mNumChildren[0]==0 ? mSurface : mData.mFBO;
 
-    return ret+1;
+    if( input.setAsInput() )
+      {
+      ret++;
+      mEffects.drawPriv(halfX, halfY, mMesh, surface, currTime);
+      }
+
+    return ret;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
