commit b6a5d557ac91275b38f53ce68674feccc0620192
Author: Leszek Koltunski <leszek@distoretedandroid.org>
Date:   Thu Dec 15 15:31:41 2016 +0000

    Change in the API: we always have to create a DistortedFramebuffer to render to.

diff --git a/src/main/java/org/distorted/library/Distorted.java b/src/main/java/org/distorted/library/Distorted.java
index c2a8798..7b79f57 100644
--- a/src/main/java/org/distorted/library/Distorted.java
+++ b/src/main/java/org/distorted/library/Distorted.java
@@ -27,7 +27,6 @@ import java.io.InputStreamReader;
 import android.content.Context;
 import android.opengl.GLES20;
 import android.os.Build;
-import android.util.Log;
 
 import org.distorted.library.exception.*;
 
@@ -82,15 +81,12 @@ public class Distorted
    */
   public static final int CLONE_CHILDREN= 0x10;
 
-  private static final String TAG = Distorted.class.getSimpleName();
   private static boolean mInitialized = false;
 
   static int mPositionH;       // model position information
   static int mNormalH;         // model normal information.
   static int mTextureCoordH;   // model texture coordinate information.
 
-  static DistortedFramebuffer mFramebuffer = new DistortedFramebuffer(0); // output to the screen
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   private Distorted()
@@ -110,8 +106,8 @@ public class Distorted
     GLES20.glGetIntegerv(GLES20.GL_MAX_FRAGMENT_UNIFORM_VECTORS, param, 0);
     maxF = param[0];
     
-    Log.d(TAG, "Max vectors in vertex shader: "+maxV);
-    Log.d(TAG, "Max vectors in fragment shader: "+maxF);
+    //Log.d("Distorted", "Max vectors in vertex shader: "+maxV);
+    //Log.d("Distorted", "Max vectors in fragment shader: "+maxF);
     
     if( !Build.FINGERPRINT.contains("generic") )
       {
@@ -200,7 +196,7 @@ public class Distorted
       final int[] numberOfUniforms = new int[1];
       GLES20.glGetProgramiv(programHandle, GLES20.GL_ACTIVE_UNIFORMS, numberOfUniforms, 0);
 
-      android.util.Log.d(TAG, "number of active uniforms="+numberOfUniforms[0]);
+      //android.util.Log.d("Distorted", "number of active uniforms="+numberOfUniforms[0]);
       }
  
     return programHandle;
@@ -278,23 +274,6 @@ public class Distorted
     return readTextFileFromRawResource( c, R.raw.main_fragment_shader);
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Public API
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Sets Vertical Field of View angle and the point the camera is looking at. This changes the Projection Matrix.
- *   
- * @param fov Vertical Field Of View angle, in degrees. If T is the middle of the top edge of the 
- *            screen, E is the eye point, and B is the middle of the bottom edge of the screen, then 
- *            fov = angle(TEB)
- * @param x   X-coordinate of the point the camera is looking at. -scrWidth/2 &lt; x &lt; scrWidth/2
- * @param y   Y-coordinate of the point the camera is looking at. -scrHeight/2 &lt; y &lt; scrHeight/2
- */
-  public static void setProjection(float fov, float x, float y)
-    {
-    mFramebuffer.setProjection(fov,x,y);
-    }
-  
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * When OpenGL context gets created, you need to call this method so that the library can initialise its internal data structures.
@@ -324,8 +303,6 @@ public class Distorted
       
     int programH = createAndLinkProgram(vertexShaderHandle, fragmentShaderHandle, new String[] {"a_Position",  "a_Color", "a_Normal", "a_TexCoordinate"});
 
-    mFramebuffer.setProjection(60.0f,0.0f,0.0f);
-
     GLES20.glUseProgram(programH);
 
     int textureUniformH = GLES20.glGetUniformLocation(programH, "u_Texture");
@@ -354,19 +331,6 @@ public class Distorted
     DistortedObjectTree.reset();
     EffectMessageSender.startSending();
     }
-  
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Call this when the physical size of the surface we are rendering to changes.
- * I.e. must be called from GLSurfaceView.onSurfaceChanged()  
- *   
- * @param surfaceWidth  new width of the surface.
- * @param surfaceHeight new height of the surface.
- */
-  public static void onSurfaceChanged(int surfaceWidth, int surfaceHeight)
-    {
-    mFramebuffer.resize(surfaceWidth,surfaceHeight);
-    }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
diff --git a/src/main/java/org/distorted/library/DistortedEffectQueues.java b/src/main/java/org/distorted/library/DistortedEffectQueues.java
index f333778..438c74d 100644
--- a/src/main/java/org/distorted/library/DistortedEffectQueues.java
+++ b/src/main/java/org/distorted/library/DistortedEffectQueues.java
@@ -154,8 +154,6 @@ public class DistortedEffectQueues
  * Copy constructor.
  * <p>
  * Whatever we do not clone gets created just like in the default constructor.
- * We only call this from the descendant's classes' constructors where we have to pay attention
- * to give it the appropriate type of a DistortedObject!
  *
  * @param dc    Source object to create our object from
  * @param flags A bitmask of values specifying what to copy.
@@ -169,27 +167,7 @@ public class DistortedEffectQueues
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
- * Draw the DistortedObject to the location specified by current Matrix effects.    
- * <p>
- * Must be called from a thread holding OpenGL Context
- *
- * @param currTime current time, in milliseconds.
- *        This gets passed on to Dynamics inside the Effects that are currently applied to the
- *        Object.
- */
-  public void draw(long currTime, DistortedTexture tex, GridObject grid)
-    {
-    tex.createTexture();
-    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
-    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, tex.mTextureDataH[0]);
-    drawPriv(currTime, tex, grid, Distorted.mFramebuffer);
-    DistortedFramebuffer.deleteAllMarked();
-    DistortedTexture.deleteAllMarked();
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Draw the DistortedObject to the Framebuffer passed.
+ * Draw the (texture,grid) object to the Framebuffer passed.
  * <p>
  * Must be called from a thread holding OpenGL Context
  *
diff --git a/src/main/java/org/distorted/library/DistortedObjectTree.java b/src/main/java/org/distorted/library/DistortedObjectTree.java
index f2da08d..2dbcd96 100644
--- a/src/main/java/org/distorted/library/DistortedObjectTree.java
+++ b/src/main/java/org/distorted/library/DistortedObjectTree.java
@@ -449,22 +449,6 @@ public class DistortedObjectTree
       RecomputeNodeID(prev);
       }
     }
-  
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Draws the Node, and all its children, to the default framebuffer 0 (i.e. the screen).
- * <p>
- * Must be called from a thread holding OpenGL Context
- *
- * @param currTime Current time, in milliseconds.
- */
-  public void draw(long currTime)
-    {  
-    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
-    drawRecursive(currTime,Distorted.mFramebuffer);
-    DistortedFramebuffer.deleteAllMarked();
-    DistortedTexture.deleteAllMarked();
-    }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
