commit b448e6b9370b8b93cdf074b2922e144f40aa7e39
Author: Leszek Koltunski <leszek@distorted.org>
Date:   Mon Dec 5 12:12:15 2016 +0000

    Minor progress with RenderTarget

diff --git a/src/main/java/org/distorted/library/DistortedRenderTarget.java b/src/main/java/org/distorted/library/DistortedRenderTarget.java
index 8575023..f1e6062 100644
--- a/src/main/java/org/distorted/library/DistortedRenderTarget.java
+++ b/src/main/java/org/distorted/library/DistortedRenderTarget.java
@@ -28,6 +28,7 @@ public class DistortedRenderTarget
   {
   private static final int TEXTURE_FAILED_TO_CREATE = -1;
   private static final int TEXTURE_NOT_CREATED_YET  = -2;
+  private static final int TEXTURE_DONT_CREATE      = -3;
 
   private int mFramebufferID, mTextureID;
   private float mX, mY;
@@ -131,20 +132,35 @@ public class DistortedRenderTarget
 
     mHeight        = height;
     mWidth         = width;
-    mFramebufferID = 0;
+    mFramebufferID = -1;
     mTextureID     = TEXTURE_NOT_CREATED_YET;
-    mFOV           = 6.0f;
+    mFOV           = 60.0f;
     mX             = 0.0f;
     mY             = 0.0f;
 
     createProjection();
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public DistortedRenderTarget(int fbo)
+    {
+    mProjectionMatrix = new float[16];
+
+    mFramebufferID = fbo;
+    mTextureID     = TEXTURE_DONT_CREATE;
+    mFOV           = 60.0f;
+    mX             = 0.0f;
+    mY             = 0.0f;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public void release()
     {
     if( mTextureID>=0 ) deleteFBO();
+
+    mProjectionMatrix = null;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -177,13 +193,6 @@ public class DistortedRenderTarget
     return mFramebufferID;
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public int getTexture()
-    {
-    return mTextureID;
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // set this as Render Target. Must be called from a thread holding OpenGL context.
 
@@ -191,6 +200,6 @@ public class DistortedRenderTarget
     {
     if( mTextureID==TEXTURE_NOT_CREATED_YET ) createFBO();
 
-
+    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFramebufferID);
     }
   }
