commit a0f644b77daf3eaa9f7b4c1f33dcb674093cf40c
Author: Leszek Koltunski <leszek@distoretedandroid.org>
Date:   Thu Dec 15 16:28:45 2016 +0000

    Again change of API. Now instead of the 'DistortedEffects.draw() and DistortedTree.draw()' we have 'DistortedFramebuffer.renderTo()'

diff --git a/src/main/java/org/distorted/library/DistortedEffects.java b/src/main/java/org/distorted/library/DistortedEffects.java
index b22dd75..c742dc8 100644
--- a/src/main/java/org/distorted/library/DistortedEffects.java
+++ b/src/main/java/org/distorted/library/DistortedEffects.java
@@ -165,26 +165,6 @@ public class DistortedEffects
     initializeEffectLists(dc,flags);
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Draw the (texture,grid) object to the Framebuffer passed.
- * <p>
- * Must be called from a thread holding OpenGL Context
- *
- * @param currTime Current time, in milliseconds.
- * @param df       Framebuffer to render this to.
- */
-  public void draw(long currTime, DistortedTexture tex, GridObject grid, DistortedFramebuffer df)
-    {
-    tex.createTexture();
-    df.createFBO();
-    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, df.fboIds[0]);
-    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, tex.mTextureDataH[0]);
-    drawPriv(currTime, tex, grid, df);
-    DistortedFramebuffer.deleteAllMarked();
-    DistortedTexture.deleteAllMarked();
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Releases all resources. After this call, the queue should not be used anymore.
diff --git a/src/main/java/org/distorted/library/DistortedFramebuffer.java b/src/main/java/org/distorted/library/DistortedFramebuffer.java
index fa0d075..fd251a2 100644
--- a/src/main/java/org/distorted/library/DistortedFramebuffer.java
+++ b/src/main/java/org/distorted/library/DistortedFramebuffer.java
@@ -245,6 +245,46 @@ public class DistortedFramebuffer
     mMarked  = false;
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Draw the (texture,grid,effects) object to the Framebuffer.
+ * <p>
+ * Must be called from a thread holding OpenGL Context
+ *
+ * @param tex input Texture to use.
+ * @param grid Class descendant from GridObject
+ * @param effects The DistortedEffects to use when rendering
+ * @param time Current time, in milliseconds.
+ */
+  public void renderTo(DistortedTexture tex, GridObject grid, DistortedEffects effects, long time)
+    {
+    tex.createTexture();
+    createFBO();
+    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fboIds[0]);
+    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, tex.mTextureDataH[0]);
+    effects.drawPriv(time, tex, grid, this);
+    DistortedFramebuffer.deleteAllMarked();
+    DistortedTexture.deleteAllMarked();
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Draws the Tree, and all its children, to the Framebuffer.
+ * <p>
+ * Must be called from a thread holding OpenGL Context
+ *
+ * @param dt DistortedTree to render.
+ * @param time Current time, in milliseconds. This will be passed to all the Effects stored in the Tree.
+ */
+  public void renderTo(DistortedTree dt, long time)
+    {
+    createFBO();
+    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fboIds[0]);
+    dt.drawRecursive(time,this);
+    DistortedFramebuffer.deleteAllMarked();
+    DistortedTexture.deleteAllMarked();
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Mark the underlying OpenGL object for deletion. Actual deletion will take place on the next render.
diff --git a/src/main/java/org/distorted/library/DistortedTree.java b/src/main/java/org/distorted/library/DistortedTree.java
index f7f880c..e6dfa1c 100644
--- a/src/main/java/org/distorted/library/DistortedTree.java
+++ b/src/main/java/org/distorted/library/DistortedTree.java
@@ -69,52 +69,6 @@ public class DistortedTree
     mMapNodeID.clear();
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-  
-  private void drawRecursive(long currTime, DistortedFramebuffer df)
-    {
-    mTexture.createTexture();
-
-    if( mNumChildren[0]<=0 )
-      {
-      GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTexture.mTextureDataH[0]);
-      }
-    else
-      {
-      mData.mDF.createFBO();
-
-      if( mData.numRendered==0 )
-        {
-        GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mData.mDF.fboIds[0]);
-
-        GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-        GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
-      
-        if( mTexture.mBitmapSet[0] )
-          {
-          GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTexture.mTextureDataH[0]);
-          mQueues.drawNoEffectsPriv(mTexture, mGrid, mData.mDF);
-          }
-      
-        synchronized(this)
-          {
-          for(int i=0; i<mNumChildren[0]; i++)
-            {
-            mChildren.get(i).drawRecursive(currTime, mData.mDF);
-            }
-          }
-        }
-
-      mData.numRendered++;
-      mData.numRendered %= mData.numPointingNodes;
-
-      GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, df.fboIds[0]);
-      GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mData.mDF.texIds[0]);
-      }
-    
-    mQueues.drawPriv(currTime, mTexture, mGrid, df);
-    }
-  
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // tree isomorphism
   
@@ -246,6 +200,52 @@ public class DistortedTree
       }
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  void drawRecursive(long currTime, DistortedFramebuffer df)
+    {
+    mTexture.createTexture();
+
+    if( mNumChildren[0]<=0 )
+      {
+      GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTexture.mTextureDataH[0]);
+      }
+    else
+      {
+      mData.mDF.createFBO();
+
+      if( mData.numRendered==0 )
+        {
+        GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mData.mDF.fboIds[0]);
+
+        GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+        GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
+
+        if( mTexture.mBitmapSet[0] )
+          {
+          GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTexture.mTextureDataH[0]);
+          mQueues.drawNoEffectsPriv(mTexture, mGrid, mData.mDF);
+          }
+
+        synchronized(this)
+          {
+          for(int i=0; i<mNumChildren[0]; i++)
+            {
+            mChildren.get(i).drawRecursive(currTime, mData.mDF);
+            }
+          }
+        }
+
+      mData.numRendered++;
+      mData.numRendered %= mData.numPointingNodes;
+
+      GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, df.fboIds[0]);
+      GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mData.mDF.texIds[0]);
+      }
+
+    mQueues.drawPriv(currTime, mTexture, mGrid, df);
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // PUBLIC API
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -450,24 +450,6 @@ public class DistortedTree
       }
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Draws the Node, and all its children, to the Framebuffer passed.
- * <p>
- * Must be called from a thread holding OpenGL Context
- *
- * @param currTime Current time, in milliseconds.
- * @param df       Framebuffer to render this to.
- */
-  public void draw(long currTime, DistortedFramebuffer df)
-    {
-    df.createFBO();
-    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, df.fboIds[0]);
-    drawRecursive(currTime,df);
-    DistortedFramebuffer.deleteAllMarked();
-    DistortedTexture.deleteAllMarked();
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Returns the DistortedEffects object that's in the Node.
