gpu: destroy glcontext on shutdown

This commit is contained in:
Adam
2018-11-18 10:27:07 -05:00
parent 53f3691488
commit 1c7113ab7c

View File

@@ -120,6 +120,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
private Canvas canvas; private Canvas canvas;
private JAWTWindow jawtWindow; private JAWTWindow jawtWindow;
private GL4 gl; private GL4 gl;
private GLContext glContext;
private GLDrawable glDrawable; private GLDrawable glDrawable;
private int glProgram; private int glProgram;
@@ -240,7 +241,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
glDrawable = glDrawableFactory.createGLDrawable(jawtWindow); glDrawable = glDrawableFactory.createGLDrawable(jawtWindow);
glDrawable.setRealized(true); glDrawable.setRealized(true);
GLContext glContext = glDrawable.createContext(null); glContext = glDrawable.createContext(null);
int res = glContext.makeCurrent(); int res = glContext.makeCurrent();
if (res == GLContext.CONTEXT_NOT_CURRENT) if (res == GLContext.CONTEXT_NOT_CURRENT)
{ {
@@ -331,6 +332,13 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
shutdownProgram(); shutdownProgram();
shutdownVao(); shutdownVao();
glContext.destroy();
jawtWindow = null;
gl = null;
glDrawable = null;
glContext = null;
vertexBuffer = null; vertexBuffer = null;
uvBuffer = null; uvBuffer = null;
modelBufferSmall = null; modelBufferSmall = null;