summaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl/impl/GLContext.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2004-04-08 19:04:23 +0000
committerKenneth Russel <[email protected]>2004-04-08 19:04:23 +0000
commitf90ab644c419486f7894fda3725a9c81de8bb283 (patch)
treefba6e3c693cbaf620f9be5d0dfb853cf7ae789d5 /src/net/java/games/jogl/impl/GLContext.java
parent0a2874e6d6a69e3f5c8392402ad1d520adf37b23 (diff)
Fixed Issue 25: Expose swapBuffers(), please
Fixed Issue 31: Make it safe to remove listeners from a GLDrawable while handling an event git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@93 232f8b59-042b-4e1e-8c03-345bb8c30851
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) {