commit 7304d89f4c672b4ee6f7ea362993031c4f5c2d4b
Author: Leszek Koltunski <leszek@distorted.org>
Date:   Tue Dec 6 15:07:15 2016 +0000

    Cleanup

diff --git a/src/main/java/org/distorted/library/DistortedFramebuffer.java b/src/main/java/org/distorted/library/DistortedFramebuffer.java
index 469c4b7..672883f 100644
--- a/src/main/java/org/distorted/library/DistortedFramebuffer.java
+++ b/src/main/java/org/distorted/library/DistortedFramebuffer.java
@@ -30,10 +30,12 @@ public class DistortedFramebuffer
   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;
   private float mFOV;
 
+  private int[] texIds = new int[1];
+  private int[] fboIds = new int[1];
+
   int mWidth,mHeight,mDepth,mDistance;
   float[] mProjectionMatrix;
   boolean mMarked;
@@ -80,13 +82,9 @@ public class DistortedFramebuffer
 
   private boolean createFBO()
     {
-    int[] texIds = new int[1];
-    int[] fboIds = new int[1];
-
     GLES20.glGenTextures(1, texIds, 0);
-    mTextureID = texIds[0];
 
-    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureID);
+    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texIds[0]);
     GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
     GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
     GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_REPEAT);
@@ -95,7 +93,7 @@ public class DistortedFramebuffer
 
     GLES20.glGenFramebuffers(1, fboIds, 0);
     GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fboIds[0]);
-    GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, mTextureID, 0);
+    GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, texIds[0], 0);
     int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER);
 
     if(status != GLES20.GL_FRAMEBUFFER_COMPLETE)
@@ -104,14 +102,12 @@ public class DistortedFramebuffer
 
       GLES20.glDeleteTextures(1, texIds, 0);
       GLES20.glDeleteFramebuffers(1, fboIds, 0);
-      mFramebufferID = 0;
-      mTextureID = TEXTURE_FAILED_TO_CREATE;
+      fboIds[0] = 0;
+      texIds[0] = TEXTURE_FAILED_TO_CREATE;
       return false;
       }
 
-    mFramebufferID = fboIds[0];
-
-    android.util.Log.e("FBO", "creating ("+mWidth+","+mHeight+") "+mFramebufferID);
+    android.util.Log.e("FBO", "creating ("+mWidth+","+mHeight+") "+fboIds[0]);
 
     return true;
     }
@@ -121,19 +117,13 @@ public class DistortedFramebuffer
 
   private void deleteFBO()
     {
-    android.util.Log.e("FBO", "deleting ("+mWidth+","+mHeight+") "+mFramebufferID);
-
-    int[] texIds = new int[1];
-    int[] fboIds = new int[1];
-
-    texIds[0] = mTextureID;
-    fboIds[0] = mFramebufferID;
+    android.util.Log.e("FBO", "deleting ("+mWidth+","+mHeight+") "+fboIds[0]);
 
     GLES20.glDeleteTextures(1, texIds, 0);
     GLES20.glDeleteFramebuffers(1, fboIds, 0);
 
-    mFramebufferID = 0;
-    mTextureID = TEXTURE_NOT_CREATED_YET;
+    fboIds[0] = 0;
+    texIds[0] = TEXTURE_NOT_CREATED_YET;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -141,7 +131,7 @@ public class DistortedFramebuffer
 
   void release()
     {
-    if( mTextureID>=0 ) deleteFBO();
+    if( texIds[0]>=0 ) deleteFBO();
 
     mProjectionMatrix = null;
     mMarked = false;
@@ -151,7 +141,7 @@ public class DistortedFramebuffer
 
   void reset()
     {
-    mTextureID = TEXTURE_NOT_CREATED_YET;
+    texIds[0] = TEXTURE_NOT_CREATED_YET;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -163,8 +153,8 @@ public class DistortedFramebuffer
 
     mHeight        = height;
     mWidth         = width;
-    mFramebufferID = -1;
-    mTextureID     = TEXTURE_NOT_CREATED_YET;
+    fboIds[0]      = -1;
+    texIds[0]      = TEXTURE_NOT_CREATED_YET;
     mFOV           = 60.0f;
     mX             = 0.0f;
     mY             = 0.0f;
@@ -182,8 +172,8 @@ public class DistortedFramebuffer
     {
     mProjectionMatrix = new float[16];
 
-    mFramebufferID = fbo;
-    mTextureID     = TEXTURE_DONT_CREATE;
+    fboIds[0]      = fbo;
+    texIds[0]      = TEXTURE_DONT_CREATE;
     mFOV           = 60.0f;
     mX             = 0.0f;
     mY             = 0.0f;
@@ -195,7 +185,7 @@ public class DistortedFramebuffer
 
   public void markForDeletion()
     {
-    android.util.Log.e("FBO", "marking for deletion ("+mWidth+","+mHeight+") "+mFramebufferID);
+    android.util.Log.e("FBO", "marking for deletion ("+mWidth+","+mHeight+") "+fboIds[0]);
 
     DistortedFramebufferList.markForDeletion();
     mMarked = true;
@@ -223,7 +213,7 @@ public class DistortedFramebuffer
 
       createProjection();
 
-      if( mTextureID>0 ) markForDeletion();
+      if( texIds[0]>0 ) markForDeletion();
       }
     }
 
@@ -231,7 +221,7 @@ public class DistortedFramebuffer
 
   public int getFBO()
     {
-    return mFramebufferID;
+    return fboIds[0];
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -239,9 +229,9 @@ public class DistortedFramebuffer
 
   public void setOutput()
     {
-    if( mTextureID==TEXTURE_NOT_CREATED_YET ) createFBO();
+    if( texIds[0]==TEXTURE_NOT_CREATED_YET ) createFBO();
 
-    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFramebufferID);
+    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fboIds[0]);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -249,9 +239,9 @@ public class DistortedFramebuffer
 
   public void setInput()
     {
-    if( mTextureID==TEXTURE_NOT_CREATED_YET ) createFBO();
+    if( texIds[0]==TEXTURE_NOT_CREATED_YET ) createFBO();
 
-    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureID);
+    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texIds[0]);
     }
 
   }
