From 92fce556bf9c3d8f1e99bf79f48631d58829c523 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 17 Jun 2013 04:09:14 +0200
Subject: GLFBODrawableImpl: Fix swap criteria, i.e. don't swap in
contextMadeCurrent(false) if already swapped by swapBuffersImpl(..), but
always swap in swapBuffersImpl(..) if ctx is current and associated.
---
src/jogl/classes/jogamp/opengl/GLDrawableImpl.java | 1 +
.../classes/jogamp/opengl/GLFBODrawableImpl.java | 27 ++++++++++++++--------
2 files changed, 18 insertions(+), 10 deletions(-)
(limited to 'src/jogl')
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
index 877e7b60b..e1088da29 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
@@ -116,6 +116,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
* {@link GL#glFlush()} has been called already and
* the implementation may execute implementation specific code.
*
+ * @param doubleBuffered indicates whether double buffering is enabled, see above.
*/
protected abstract void swapBuffersImpl(boolean doubleBuffered);
diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index 85f63b52c..27024d4e1 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -52,7 +52,10 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
private int fboIBack; // points to GL_BACK buffer
private int fboIFront; // points to GL_FRONT buffer
private int pendingFBOReset = -1;
+ /** Indicated whether the FBO is bound. */
private boolean fboBound;
+ /** Indicated whether the FBO is swapped, resets to false after makeCurrent -> contextMadeCurrent. */
+ private boolean fboSwapped;
/** dump fboResetQuirk info only once pre ClassLoader and only in DEBUG mode */
private static volatile boolean resetQuirkInfoDumped = false;
@@ -139,21 +142,20 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
}
}
fbos[fboIFront].resetSamplingSink(gl);
- fboBound = false;
+
fbos[0].formatToGLCapabilities(chosenFBOCaps);
chosenFBOCaps.setDoubleBuffered( chosenFBOCaps.getDoubleBuffered() || samples > 0 );
-
- initialized = true;
} else {
- initialized = false;
-
for(int i=0; i