aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-jogl/src/main/java/com
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2013-03-17 21:37:07 +0100
committerJulien Gouesse <[email protected]>2013-03-17 21:37:07 +0100
commit89fb76eea970f59ca8e1dc842eb20086cad5f93a (patch)
treef5f18769707ab5ad77a005fe31884204c0496267 /ardor3d-jogl/src/main/java/com
parentd558bdff0cc394ad536c4dc94a0871c6b73abfcc (diff)
Adds setVSyncEnabled(boolean) into AWT-based canvases
Diffstat (limited to 'ardor3d-jogl/src/main/java/com')
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java12
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java10
2 files changed, 22 insertions, 0 deletions
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java
index 36cc77e..6e3d140 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java
@@ -13,6 +13,8 @@ package com.ardor3d.framework.jogl;
import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.CountDownLatch;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLRunnable;
import javax.media.opengl.awt.GLCanvas;
import javax.swing.SwingUtilities;
@@ -90,4 +92,14 @@ public class JoglAwtCanvas extends GLCanvas implements Canvas {
public JoglCanvasRenderer getCanvasRenderer() {
return _canvasRenderer;
}
+
+ public void setVSyncEnabled(final boolean enabled) {
+ invoke(true, new GLRunnable() {
+ @Override
+ public boolean run(final GLAutoDrawable glAutoDrawable) {
+ glAutoDrawable.getGL().setSwapInterval(enabled ? 1 : 0);
+ return false;
+ }
+ });
+ }
}
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java
index fa91851..0de1c99 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java
@@ -93,4 +93,14 @@ public class JoglNewtAwtCanvas extends NewtCanvasAWT implements Canvas, NewtWind
public GLWindow getNewtWindow() {
return (GLWindow) getNEWTChild();
}
+
+ public void setVSyncEnabled(final boolean enabled) {
+ getNewtWindow().invoke(true, new GLRunnable() {
+ @Override
+ public boolean run(final GLAutoDrawable glAutoDrawable) {
+ glAutoDrawable.getGL().setSwapInterval(enabled ? 1 : 0);
+ return false;
+ }
+ });
+ }
}