Correctly clean up the created OpenGL objects created for the slider rendering.

This is necessary because the OpenGL context being closed does apparently not close
the process and the game can be restarted with another resolution without shutting
down the process completely.
This commit is contained in:
Peter Tissen
2015-06-24 23:55:05 +02:00
parent 392df79596
commit 1993452669
4 changed files with 62 additions and 4 deletions

View File

@@ -75,6 +75,12 @@ public class CurveRenderState {
//scale = scale * 118 / 128; //for curves exactly as big as the sliderball
FrameBufferCache.init(width, height);
}
public static void shutdown()
{
staticState.shutdown();
FrameBufferCache.shutdown();
}
/**
* Creates an object to hold the render state that's necessary to draw a curve.
@@ -447,5 +453,25 @@ public class CurveRenderState {
colBorderLoc = GL20.glGetUniformLocation(program, "col_border");
}
}
private void shutdown()
{
if(gradientTexture != 0)
{
GL11.glDeleteTextures(gradientTexture);
gradientTexture = 0;
}
if(program != 0)
{
GL20.glDeleteProgram(program);
program = 0;
attribLoc = 0;
texCoordLoc = 0;
colLoc = 0;
colBorderLoc = 0;
texLoc = 0;
}
}
}
}