From 0644c286ef93e0d29efd77e32f4a37e8908a274c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 19 Sep 2014 13:24:01 -0400 Subject: [PATCH 1/2] Updated JOGL canvas classes to fix shutdown bug. Also added frame rate support. --- .../src/main/java/com/jme3/system/jogl/JoglCanvas.java | 7 +++++++ .../main/java/com/jme3/system/jogl/JoglNewtCanvas.java | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglCanvas.java b/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglCanvas.java index 1e9b0db25..3621aa255 100644 --- a/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglCanvas.java +++ b/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglCanvas.java @@ -65,6 +65,7 @@ public class JoglCanvas extends JoglAbstractDisplay implements JmeCanvasContext public void destroy(boolean waitFor){ if (waitFor) waitFor(false); + animator.stop(); } @Override @@ -89,6 +90,12 @@ public class JoglCanvas extends JoglAbstractDisplay implements JmeCanvasContext listener.initialize(); } + @Override + protected void startGLCanvas() { + frameRate = settings.getFrameRate(); + super.startGLCanvas(); + } + public void display(GLAutoDrawable glad) { if (!created.get() && renderer != null){ listener.destroy(); diff --git a/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglNewtCanvas.java b/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglNewtCanvas.java index 6b6824938..46ec21ca1 100644 --- a/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglNewtCanvas.java +++ b/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglNewtCanvas.java @@ -48,7 +48,7 @@ public class JoglNewtCanvas extends JoglNewtAbstractDisplay implements JmeCanvas super(); initGLCanvas(); } - + @Override protected final void initGLCanvas() { super.initGLCanvas(); @@ -85,6 +85,7 @@ public class JoglNewtCanvas extends JoglNewtAbstractDisplay implements JmeCanvas public void destroy(boolean waitFor){ if (waitFor) waitFor(false); + animator.stop(); } @Override @@ -109,6 +110,12 @@ public class JoglNewtCanvas extends JoglNewtAbstractDisplay implements JmeCanvas listener.initialize(); } + @Override + protected void startGLCanvas() { + frameRate = settings.getFrameRate(); + super.startGLCanvas(); + } + public void display(GLAutoDrawable glad) { if (!created.get() && renderer != null){ listener.destroy(); From 6dace77a7aad8098a42bee64e8c764a68f1b4ae2 Mon Sep 17 00:00:00 2001 From: saloisio Date: Mon, 22 Sep 2014 09:36:37 -0400 Subject: [PATCH 2/2] Animator is stopped only if it is currently animating. --- .../src/main/java/com/jme3/system/jogl/JoglCanvas.java | 7 ++++--- .../src/main/java/com/jme3/system/jogl/JoglNewtCanvas.java | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglCanvas.java b/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglCanvas.java index 3621aa255..a4646b44f 100644 --- a/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglCanvas.java +++ b/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglCanvas.java @@ -65,7 +65,8 @@ public class JoglCanvas extends JoglAbstractDisplay implements JmeCanvasContext public void destroy(boolean waitFor){ if (waitFor) waitFor(false); - animator.stop(); + if (animator.isAnimating()) + animator.stop(); } @Override @@ -122,7 +123,7 @@ public class JoglCanvas extends JoglAbstractDisplay implements JmeCanvasContext animator.stop(); wasAnimating = false; } - + listener.update(); renderer.onFrame(); @@ -133,7 +134,7 @@ public class JoglCanvas extends JoglAbstractDisplay implements JmeCanvasContext } @Override - public void dispose(GLAutoDrawable arg0) { + public void dispose(GLAutoDrawable arg0) { } } diff --git a/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglNewtCanvas.java b/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglNewtCanvas.java index 46ec21ca1..cb84c94a9 100644 --- a/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglNewtCanvas.java +++ b/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglNewtCanvas.java @@ -85,7 +85,8 @@ public class JoglNewtCanvas extends JoglNewtAbstractDisplay implements JmeCanvas public void destroy(boolean waitFor){ if (waitFor) waitFor(false); - animator.stop(); + if (animator.isAnimating()) + animator.stop(); } @Override