Project

General

Profile

« Previous | Next » 

Revision b0ac5b29

Added by Leszek Koltunski over 2 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/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