v0.9.4: fixed cases of vertex buffers not being cleared
This commit is contained in:
parent
d47c8d1fac
commit
020d14011f
|
@ -103,7 +103,15 @@ public class Vertexbuffer {
|
|||
}
|
||||
}
|
||||
|
||||
public static void refreshAllBuffers(){
|
||||
public static void clear(){
|
||||
synchronized (buffers) {
|
||||
for (Vertexbuffer buf : buffers.toArray(new Vertexbuffer[0])) {
|
||||
buf.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void reload(){
|
||||
synchronized (buffers) {
|
||||
for (Vertexbuffer buf : buffers) {
|
||||
buf.updateVertices();
|
||||
|
|
|
@ -102,7 +102,7 @@ public class Game implements ApplicationListener {
|
|||
versionContextRef = Gdx.graphics.getGLVersion();
|
||||
Blending.useDefault();
|
||||
TextureCache.reload();
|
||||
Vertexbuffer.refreshAllBuffers();
|
||||
Vertexbuffer.reload();
|
||||
}
|
||||
|
||||
private GLVersion versionContextRef;
|
||||
|
@ -119,7 +119,7 @@ public class Game implements ApplicationListener {
|
|||
versionContextRef = Gdx.graphics.getGLVersion();
|
||||
Blending.useDefault();
|
||||
TextureCache.reload();
|
||||
Vertexbuffer.refreshAllBuffers();
|
||||
Vertexbuffer.reload();
|
||||
}
|
||||
|
||||
height -= bottomInset;
|
||||
|
@ -248,6 +248,8 @@ public class Game implements ApplicationListener {
|
|||
if (scene != null) {
|
||||
scene.destroy();
|
||||
}
|
||||
//clear any leftover vertex buffers
|
||||
Vertexbuffer.clear();
|
||||
scene = requestedScene;
|
||||
if (onChange != null) onChange.beforeCreate();
|
||||
scene.create();
|
||||
|
|
|
@ -245,6 +245,7 @@ public class PixelScene extends Scene {
|
|||
if ((time -= Game.elapsed) <= 0) {
|
||||
alpha( 0f );
|
||||
parent.remove( this );
|
||||
destroy();
|
||||
} else {
|
||||
alpha( time / FADE_TIME );
|
||||
}
|
||||
|
|
|
@ -213,5 +213,12 @@ public class KeyDisplay extends Visual {
|
|||
dirty = false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
super.destroy();
|
||||
if (buffer != null)
|
||||
buffer.delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user