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) {
|
synchronized (buffers) {
|
||||||
for (Vertexbuffer buf : buffers) {
|
for (Vertexbuffer buf : buffers) {
|
||||||
buf.updateVertices();
|
buf.updateVertices();
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class Game implements ApplicationListener {
|
||||||
versionContextRef = Gdx.graphics.getGLVersion();
|
versionContextRef = Gdx.graphics.getGLVersion();
|
||||||
Blending.useDefault();
|
Blending.useDefault();
|
||||||
TextureCache.reload();
|
TextureCache.reload();
|
||||||
Vertexbuffer.refreshAllBuffers();
|
Vertexbuffer.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
private GLVersion versionContextRef;
|
private GLVersion versionContextRef;
|
||||||
|
@ -119,7 +119,7 @@ public class Game implements ApplicationListener {
|
||||||
versionContextRef = Gdx.graphics.getGLVersion();
|
versionContextRef = Gdx.graphics.getGLVersion();
|
||||||
Blending.useDefault();
|
Blending.useDefault();
|
||||||
TextureCache.reload();
|
TextureCache.reload();
|
||||||
Vertexbuffer.refreshAllBuffers();
|
Vertexbuffer.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
height -= bottomInset;
|
height -= bottomInset;
|
||||||
|
@ -248,6 +248,8 @@ public class Game implements ApplicationListener {
|
||||||
if (scene != null) {
|
if (scene != null) {
|
||||||
scene.destroy();
|
scene.destroy();
|
||||||
}
|
}
|
||||||
|
//clear any leftover vertex buffers
|
||||||
|
Vertexbuffer.clear();
|
||||||
scene = requestedScene;
|
scene = requestedScene;
|
||||||
if (onChange != null) onChange.beforeCreate();
|
if (onChange != null) onChange.beforeCreate();
|
||||||
scene.create();
|
scene.create();
|
||||||
|
|
|
@ -245,6 +245,7 @@ public class PixelScene extends Scene {
|
||||||
if ((time -= Game.elapsed) <= 0) {
|
if ((time -= Game.elapsed) <= 0) {
|
||||||
alpha( 0f );
|
alpha( 0f );
|
||||||
parent.remove( this );
|
parent.remove( this );
|
||||||
|
destroy();
|
||||||
} else {
|
} else {
|
||||||
alpha( time / FADE_TIME );
|
alpha( time / FADE_TIME );
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,4 +214,11 @@ public class KeyDisplay extends Visual {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
super.destroy();
|
||||||
|
if (buffer != null)
|
||||||
|
buffer.delete();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user