diff options
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/java/games/jogl/GLJPanel.java | 19 | ||||
-rw-r--r-- | src/net/java/games/jogl/impl/GLPbufferImpl.java | 19 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/net/java/games/jogl/GLJPanel.java b/src/net/java/games/jogl/GLJPanel.java index b887d01c1..3ac5c984c 100644 --- a/src/net/java/games/jogl/GLJPanel.java +++ b/src/net/java/games/jogl/GLJPanel.java @@ -182,6 +182,18 @@ public final class GLJPanel extends JPanel implements GLDrawable { return false; } + public void setAutoSwapBufferMode(boolean onOrOff) { + context.setAutoSwapBufferMode(onOrOff); + } + + public boolean getAutoSwapBufferMode() { + return context.getAutoSwapBufferMode(); + } + + public void swapBuffers() { + context.invokeGL(swapBuffersAction, false, initAction); + } + public boolean canCreateOffscreenDrawable() { // For now let's say no; maybe we can reimplement this class in // terms of pbuffers (though not all vendors support them, and @@ -304,4 +316,11 @@ public final class GLJPanel extends JPanel implements GLDrawable { } } private DisplayAction displayAction = new DisplayAction(); + + class SwapBuffersAction implements Runnable { + public void run() { + context.swapBuffers(); + } + } + private SwapBuffersAction swapBuffersAction = new SwapBuffersAction(); } diff --git a/src/net/java/games/jogl/impl/GLPbufferImpl.java b/src/net/java/games/jogl/impl/GLPbufferImpl.java index 2e5f5589f..2fb927c92 100644 --- a/src/net/java/games/jogl/impl/GLPbufferImpl.java +++ b/src/net/java/games/jogl/impl/GLPbufferImpl.java @@ -126,6 +126,18 @@ public class GLPbufferImpl implements GLPbuffer { return false; } + public void setAutoSwapBufferMode(boolean onOrOff) { + context.setAutoSwapBufferMode(onOrOff); + } + + public boolean getAutoSwapBufferMode() { + return context.getAutoSwapBufferMode(); + } + + public void swapBuffers() { + context.invokeGL(swapBuffersAction, false, initAction); + } + public boolean canCreateOffscreenDrawable() { return false; } @@ -202,4 +214,11 @@ public class GLPbufferImpl implements GLPbuffer { } } private DisplayAction displayAction = new DisplayAction(); + + class SwapBuffersAction implements Runnable { + public void run() { + context.swapBuffers(); + } + } + private SwapBuffersAction swapBuffersAction = new SwapBuffersAction(); } |