Project

General

Profile

« Previous | Next » 

Revision b0ac5b29

Added by Leszek Koltunski almost 3 years ago

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.

View differences:

src/main/java/org/distorted/library/main/DistortedScreen.java
126 126
        mDebugAllocated = true;
127 127
        debugString = "";
128 128

  
129
        if( mDebugWidth<=0 || mDebugHeight<=0 )
130
          {
131
          mDebugWidth = (int)(mWidth*DEBUG_SCR_FRAC);
132
          mDebugHeight= (int)(mWidth*DEBUG_SCR_FRAC*DEBUG_FRAC);
133
          }
134

  
129 135
        debugBitmap = Bitmap.createBitmap( mDebugWidth, mDebugHeight, Bitmap.Config.ARGB_8888);
130 136
        debugMesh = new MeshQuad();
131 137
        debugTexture = new DistortedTexture();
src/main/java/org/distorted/library/main/InternalBuffer.java
171 171
    }
172 172

  
173 173
///////////////////////////////////////////////////////////////////////////////////////////////////
174
// must be called from a thread holding OpenGL Context
174
// Intentionally empty, no need to do anything here since it will be done in createImmediatelyXXX().
175
// In fact, recreating a Mesh's mVBO1 here - rather than in createImmediatelyFloat - was the reason
176
// of the 'disappearing cube after the mesh has changed from nice to simple' bug. I don't quite
177
// understand why TBH.
175 178

  
176 179
  void create()
177 180
    {
178
    GLES30.glGenBuffers( 1, mIndex, 0);
179
    GLES30.glBindBuffer( mTarget, mIndex[0]);
180
    GLES30.glBufferData( mTarget, mSize, mBuffer, mUsage);
181
    GLES30.glBindBuffer( mTarget, 0);
182 181

  
183
    mStatus = DONE;
184 182
    }
185 183

  
186 184
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff