commit b0ac5b29a623e4e6080d6bda598295ff28a7b340
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Fri Dec 17 00:34:19 2021 +0100

    Important bugfix for the 'cube disappears when its mesh gets changed from nice to simple'.
    
    The reason why recreating an InternalBuffer from within the 'create()' function doesn't work but doing the same from 'createImmediately' does work is not fully understood. Nevertheless the fix is correct in the sense that it
    
    a) for sure does fix the (repeatably reproducible) bug
    b) IMHO carries zero risk of introducing any problems.

diff --git a/src/main/java/org/distorted/library/main/DistortedScreen.java b/src/main/java/org/distorted/library/main/DistortedScreen.java
index 57156bf..13ed645 100644
--- a/src/main/java/org/distorted/library/main/DistortedScreen.java
+++ b/src/main/java/org/distorted/library/main/DistortedScreen.java
@@ -126,6 +126,12 @@ public class DistortedScreen extends DistortedFramebuffer
         mDebugAllocated = true;
         debugString = "";
 
+        if( mDebugWidth<=0 || mDebugHeight<=0 )
+          {
+          mDebugWidth = (int)(mWidth*DEBUG_SCR_FRAC);
+          mDebugHeight= (int)(mWidth*DEBUG_SCR_FRAC*DEBUG_FRAC);
+          }
+
         debugBitmap = Bitmap.createBitmap( mDebugWidth, mDebugHeight, Bitmap.Config.ARGB_8888);
         debugMesh = new MeshQuad();
         debugTexture = new DistortedTexture();
diff --git a/src/main/java/org/distorted/library/main/InternalBuffer.java b/src/main/java/org/distorted/library/main/InternalBuffer.java
index 0d46d71..21a9f92 100644
--- a/src/main/java/org/distorted/library/main/InternalBuffer.java
+++ b/src/main/java/org/distorted/library/main/InternalBuffer.java
@@ -171,16 +171,14 @@ public class InternalBuffer extends InternalObject
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-// must be called from a thread holding OpenGL Context
+// Intentionally empty, no need to do anything here since it will be done in createImmediatelyXXX().
+// In fact, recreating a Mesh's mVBO1 here - rather than in createImmediatelyFloat - was the reason
+// of the 'disappearing cube after the mesh has changed from nice to simple' bug. I don't quite
+// understand why TBH.
 
   void create()
     {
-    GLES30.glGenBuffers( 1, mIndex, 0);
-    GLES30.glBindBuffer( mTarget, mIndex[0]);
-    GLES30.glBufferData( mTarget, mSize, mBuffer, mUsage);
-    GLES30.glBindBuffer( mTarget, 0);
 
-    mStatus = DONE;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
