Merge pull request #174 from saloisio/master

Updated JOGL canvas classes to fix shutdown bug. Also added frame rate support.
experimental
Julien Gouesse 11 years ago
commit e448e46675
  1. 12
      jme3-jogl/src/main/java/com/jme3/system/jogl/JoglCanvas.java
  2. 10
      jme3-jogl/src/main/java/com/jme3/system/jogl/JoglNewtCanvas.java

@ -65,6 +65,8 @@ public class JoglCanvas extends JoglAbstractDisplay implements JmeCanvasContext
public void destroy(boolean waitFor){ public void destroy(boolean waitFor){
if (waitFor) if (waitFor)
waitFor(false); waitFor(false);
if (animator.isAnimating())
animator.stop();
} }
@Override @Override
@ -89,6 +91,12 @@ public class JoglCanvas extends JoglAbstractDisplay implements JmeCanvasContext
listener.initialize(); listener.initialize();
} }
@Override
protected void startGLCanvas() {
frameRate = settings.getFrameRate();
super.startGLCanvas();
}
public void display(GLAutoDrawable glad) { public void display(GLAutoDrawable glad) {
if (!created.get() && renderer != null){ if (!created.get() && renderer != null){
listener.destroy(); listener.destroy();
@ -115,7 +123,7 @@ public class JoglCanvas extends JoglAbstractDisplay implements JmeCanvasContext
animator.stop(); animator.stop();
wasAnimating = false; wasAnimating = false;
} }
listener.update(); listener.update();
renderer.onFrame(); renderer.onFrame();
@ -126,7 +134,7 @@ public class JoglCanvas extends JoglAbstractDisplay implements JmeCanvasContext
} }
@Override @Override
public void dispose(GLAutoDrawable arg0) { public void dispose(GLAutoDrawable arg0) {
} }
} }

@ -48,7 +48,7 @@ public class JoglNewtCanvas extends JoglNewtAbstractDisplay implements JmeCanvas
super(); super();
initGLCanvas(); initGLCanvas();
} }
@Override @Override
protected final void initGLCanvas() { protected final void initGLCanvas() {
super.initGLCanvas(); super.initGLCanvas();
@ -85,6 +85,8 @@ public class JoglNewtCanvas extends JoglNewtAbstractDisplay implements JmeCanvas
public void destroy(boolean waitFor){ public void destroy(boolean waitFor){
if (waitFor) if (waitFor)
waitFor(false); waitFor(false);
if (animator.isAnimating())
animator.stop();
} }
@Override @Override
@ -109,6 +111,12 @@ public class JoglNewtCanvas extends JoglNewtAbstractDisplay implements JmeCanvas
listener.initialize(); listener.initialize();
} }
@Override
protected void startGLCanvas() {
frameRate = settings.getFrameRate();
super.startGLCanvas();
}
public void display(GLAutoDrawable glad) { public void display(GLAutoDrawable glad) {
if (!created.get() && renderer != null){ if (!created.get() && renderer != null){
listener.destroy(); listener.destroy();

Loading…
Cancel
Save