diff --git a/src/itdelatrisu/opsu/Container.java b/src/itdelatrisu/opsu/Container.java index 070fe6e7..6fa3fc7e 100644 --- a/src/itdelatrisu/opsu/Container.java +++ b/src/itdelatrisu/opsu/Container.java @@ -133,7 +133,7 @@ public class Container extends AppGameContainer { // reset BeatmapSetList data if (BeatmapSetList.get() != null) BeatmapSetList.get().reset(); - + // delete OpenGL objects involved in the Curve rendering CurveRenderState.shutdown(); } diff --git a/src/itdelatrisu/opsu/render/CurveRenderState.java b/src/itdelatrisu/opsu/render/CurveRenderState.java index 2d93e235..12960dac 100644 --- a/src/itdelatrisu/opsu/render/CurveRenderState.java +++ b/src/itdelatrisu/opsu/render/CurveRenderState.java @@ -75,7 +75,12 @@ public class CurveRenderState { //scale = scale * 118 / 128; //for curves exactly as big as the sliderball FrameBufferCache.init(width, height); } - + + /** + * Undo the static state. Static state setup caused by calls to + * {@link #draw(org.newdawn.slick.Color, org.newdawn.slick.Color, itdelatrisu.opsu.objects.curves.Vec2f[])} + * are undone. + */ public static void shutdown() { staticState.shutdown(); @@ -144,7 +149,7 @@ public class CurveRenderState { } /** - * Discard the cache. + * Discard the cache mapping for this curve object */ public void discardCache() { fbo = null; @@ -454,14 +459,17 @@ public class CurveRenderState { } } + /** + * Cleanup any OpenGL objects that may have been initialized. + */ private void shutdown() { if(gradientTexture != 0) { - GL11.glDeleteTextures(gradientTexture); - gradientTexture = 0; + GL11.glDeleteTextures(gradientTexture); + gradientTexture = 0; } - + if(program != 0) { GL20.glDeleteProgram(program); diff --git a/src/itdelatrisu/opsu/render/FrameBufferCache.java b/src/itdelatrisu/opsu/render/FrameBufferCache.java index 83d62a03..ab4bea7b 100644 --- a/src/itdelatrisu/opsu/render/FrameBufferCache.java +++ b/src/itdelatrisu/opsu/render/FrameBufferCache.java @@ -122,11 +122,14 @@ public class FrameBufferCache { return buffer; } + /** + * Clear the cache pool of Framebuffers. + * If there were any previous Framebuffers in the cache delete them + * this is necessary for cases when the game gets re-started with a + * different resolution without closing the process + */ public static void shutdown() { - //if there were any previous Framebuffers in the cache delete them - //this is necessary for cases when the game gets re-started with a - //different resolution without closing the process FrameBufferCache fbcInstance = FrameBufferCache.getInstance(); for(Rendertarget target: fbcInstance.cache) { diff --git a/src/itdelatrisu/opsu/render/Rendertarget.java b/src/itdelatrisu/opsu/render/Rendertarget.java index 75894000..2166d52a 100644 --- a/src/itdelatrisu/opsu/render/Rendertarget.java +++ b/src/itdelatrisu/opsu/render/Rendertarget.java @@ -40,7 +40,7 @@ public class Rendertarget { /** The renderbuffer ID for the depth buffer that this rendertarget renders into. */ private final int depthBufferID; - + /** * Create a new FBO. * @param width the width @@ -115,7 +115,7 @@ public class Rendertarget { return buffer; } - + /** * Destroy the OpenGL objects associated with this Rendertarget. Do not try * to use this rendertarget with OpenGL after calling this method.