summaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl/impl/GLContext.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/games/jogl/impl/GLContext.java')
-rw-r--r--src/net/java/games/jogl/impl/GLContext.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/net/java/games/jogl/impl/GLContext.java b/src/net/java/games/jogl/impl/GLContext.java
index 82672b1c3..98e56a314 100644
--- a/src/net/java/games/jogl/impl/GLContext.java
+++ b/src/net/java/games/jogl/impl/GLContext.java
@@ -102,6 +102,10 @@ public abstract class GLContext {
// GLCanvas
protected boolean noAutoRedraw;
+ // Flag for enabling / disabling automatic swapping of the front and
+ // back buffers
+ protected boolean autoSwapBuffers = true;
+
// Offscreen context handling. Offscreen contexts should handle
// these resize requests in makeCurrent and clear the
// pendingOffscreenResize flag.
@@ -233,7 +237,9 @@ public abstract class GLContext {
deferredReshapeAction = null;
}
runnable.run();
- swapBuffers();
+ if (autoSwapBuffers && !isReshape) {
+ swapBuffers();
+ }
} catch (RuntimeException e) {
caughtException = true;
throw(e);
@@ -347,6 +353,18 @@ public abstract class GLContext {
return noAutoRedraw;
}
+ public void setAutoSwapBufferMode(boolean autoSwapBuffers) {
+ this.autoSwapBuffers = autoSwapBuffers;
+ }
+
+ public boolean getAutoSwapBufferMode() {
+ return autoSwapBuffers;
+ }
+
+ /** Swaps the buffers of the OpenGL context if necessary. All error
+ conditions cause a GLException to be thrown. */
+ public abstract void swapBuffers() throws GLException;
+
/** Routine needed only for offscreen contexts in order to resize
the underlying bitmap. Called by GLJPanel. */
public void resizeOffscreenContext(int newWidth, int newHeight) {
@@ -492,10 +510,6 @@ public abstract class GLContext {
GLException to be thrown. */
protected abstract void free() throws GLException;
- /** Swaps the buffers of the OpenGL context if necessary. All error
- conditions cause a GLException to be thrown. */
- protected abstract void swapBuffers() throws GLException;
-
/** Helper routine which resets a ProcAddressTable generated by the
GLEmitter by looking up anew all of its function pointers. */
protected void resetProcAddressTable(Object table) {