diff options
Diffstat (limited to 'src/jake2/render/opengl')
-rw-r--r-- | src/jake2/render/opengl/JoglDummyDriver.java | 14 | ||||
-rw-r--r-- | src/jake2/render/opengl/JoglES1Driver.java | 16 | ||||
-rw-r--r-- | src/jake2/render/opengl/JoglES2Driver.java | 14 | ||||
-rw-r--r-- | src/jake2/render/opengl/JoglGL2Driver.java | 14 |
4 files changed, 37 insertions, 21 deletions
diff --git a/src/jake2/render/opengl/JoglDummyDriver.java b/src/jake2/render/opengl/JoglDummyDriver.java index 5b65ecf..fb41bf7 100644 --- a/src/jake2/render/opengl/JoglDummyDriver.java +++ b/src/jake2/render/opengl/JoglDummyDriver.java @@ -71,6 +71,7 @@ public abstract class JoglDummyDriver extends DummyGL implements GLDriver { } public void shutdown() { + deactivate(); if(null != newtWin) { newtWin.shutdown(); } @@ -102,11 +103,7 @@ public abstract class JoglDummyDriver extends DummyGL implements GLDriver { public void endFrame() { // newtWin.window.swapBuffers(); - /* - final GLContext ctx = newtWin.window.getContext(); - if ( null != ctx && GLContext.getCurrent() == ctx) { - ctx.release(); - } */ + // deactivate(); newtWin.fpsCounter.tickFPS(); } @@ -136,5 +133,12 @@ public abstract class JoglDummyDriver extends DummyGL implements GLDriver { } } + protected void deactivate() { + final GLContext ctx = newtWin.window.getContext(); + if ( null != ctx && GLContext.getCurrent() == ctx) { + ctx.release(); + } + } + // -------------------------------------------------------------------------- } diff --git a/src/jake2/render/opengl/JoglES1Driver.java b/src/jake2/render/opengl/JoglES1Driver.java index afb1c12..b1d882d 100644 --- a/src/jake2/render/opengl/JoglES1Driver.java +++ b/src/jake2/render/opengl/JoglES1Driver.java @@ -72,6 +72,7 @@ public abstract class JoglES1Driver extends JoglGL2ES1 implements GLDriver { } public void shutdown() { + deactivate(); if(null != newtWin) { newtWin.shutdown(); } @@ -103,11 +104,7 @@ public abstract class JoglES1Driver extends JoglGL2ES1 implements GLDriver { public void endFrame() { newtWin.window.swapBuffers(); - /** - final GLContext ctx = newtWin.window.getContext(); - if ( null != ctx && GLContext.getCurrent() == ctx) { - ctx.release(); - } */ + // deactivate(); newtWin.fpsCounter.tickFPS(); } @@ -136,6 +133,13 @@ public abstract class JoglES1Driver extends JoglGL2ES1 implements GLDriver { ctx.makeCurrent(); } } - + + protected void deactivate() { + final GLContext ctx = newtWin.window.getContext(); + if ( null != ctx && GLContext.getCurrent() == ctx) { + ctx.release(); + } + } + // -------------------------------------------------------------------------- } diff --git a/src/jake2/render/opengl/JoglES2Driver.java b/src/jake2/render/opengl/JoglES2Driver.java index 7d2926d..5fa1f39 100644 --- a/src/jake2/render/opengl/JoglES2Driver.java +++ b/src/jake2/render/opengl/JoglES2Driver.java @@ -77,6 +77,7 @@ public abstract class JoglES2Driver extends JoglGL2ES1 implements GLDriver { } public void shutdown() { + deactivate(); if(null != newtWin) { newtWin.shutdown(); } @@ -108,11 +109,7 @@ public abstract class JoglES2Driver extends JoglGL2ES1 implements GLDriver { public void endFrame() { newtWin.window.swapBuffers(); - /* - final GLContext ctx = newtWin.window.getContext(); - if ( null != ctx && GLContext.getCurrent() == ctx) { - ctx.release(); - } */ + // deactivate(); newtWin.fpsCounter.tickFPS(); } @@ -141,6 +138,13 @@ public abstract class JoglES2Driver extends JoglGL2ES1 implements GLDriver { ctx.makeCurrent(); } } + + protected void deactivate() { + final GLContext ctx = newtWin.window.getContext(); + if ( null != ctx && GLContext.getCurrent() == ctx) { + ctx.release(); + } + } // -------------------------------------------------------------------------- } diff --git a/src/jake2/render/opengl/JoglGL2Driver.java b/src/jake2/render/opengl/JoglGL2Driver.java index ccabf7f..0f91542 100644 --- a/src/jake2/render/opengl/JoglGL2Driver.java +++ b/src/jake2/render/opengl/JoglGL2Driver.java @@ -71,6 +71,7 @@ public abstract class JoglGL2Driver extends JoglGL2ES1 implements GLDriver { } public void shutdown() { + deactivate(); if(null != newtWin) { newtWin.shutdown(); } @@ -102,11 +103,7 @@ public abstract class JoglGL2Driver extends JoglGL2ES1 implements GLDriver { public void endFrame() { newtWin.window.swapBuffers(); - /** - final GLContext ctx = newtWin.window.getContext(); - if ( null != ctx && GLContext.getCurrent() == ctx) { - ctx.release(); - } */ + // deactivate(); newtWin.fpsCounter.tickFPS(); } @@ -136,5 +133,12 @@ public abstract class JoglGL2Driver extends JoglGL2ES1 implements GLDriver { } } + protected void deactivate() { + final GLContext ctx = newtWin.window.getContext(); + if ( null != ctx && GLContext.getCurrent() == ctx) { + ctx.release(); + } + } + // -------------------------------------------------------------------------- } |