diff options
author | Sven Gothel <[email protected]> | 2012-09-29 03:02:09 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-09-29 03:02:09 +0200 |
commit | 4f8432b0a5ac2a030056884c8f6c877435aaf5c8 (patch) | |
tree | f1b3ad8f1f1e9011b642bc7ac36fee92b433bc16 | |
parent | 27fe889023c7366e264647e5dc25053f22df0956 (diff) |
GLDrawableHelper.init(..): Avoid double reshape if subsequent display issues reshape
Adding boolean sendReshape argument to be set to false, if subsequent display won't reshape.
5 files changed, 10 insertions, 7 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java index 02f62daec..6fec18470 100644 --- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java +++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java @@ -118,7 +118,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { private final Runnable initAction = new Runnable() { @Override public void run() { - helper.init(GLCanvas.this); + helper.init(GLCanvas.this, !sendReshape); } }; diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index 329cf9e3f..335322be9 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -947,7 +947,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing private final Runnable initAction = new Runnable() { @Override public void run() { - helper.init(GLCanvas.this); + helper.init(GLCanvas.this, !sendReshape); } }; diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 6d4a5861f..d0b9fb913 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -679,7 +679,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if (!backend.preGL(g)) { return; } - helper.init(GLJPanel.this); + helper.init(GLJPanel.this, !sendReshape); backend.postGL(g, false); } diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java index 07029f143..d49fc75d9 100644 --- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java +++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java @@ -265,7 +265,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter { @Override public final void run() { // Lock: Locked Surface/Window by MakeCurrent/Release - helper.init(GLAutoDrawableBase.this); + helper.init(GLAutoDrawableBase.this, !sendReshape); resetFPSCounter(); } }; diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index 83b16884e..13c387231 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -330,8 +330,11 @@ public class GLDrawableHelper { } } - /** The default init action to be called once after ctx is being created @ 1st makeCurrent(). */ - public final void init(GLAutoDrawable drawable) { + /** + * The default init action to be called once after ctx is being created @ 1st makeCurrent(). + * @param sendReshape set to true if the subsequent display call won't reshape, otherwise false to avoid double reshape. + **/ + public final void init(GLAutoDrawable drawable, boolean sendReshape) { synchronized(listenersLock) { final ArrayList<GLEventListener> _listeners = listeners; for (int i=0; i < _listeners.size(); i++) { @@ -341,7 +344,7 @@ public class GLDrawableHelper { // This may happen not just for initial setup, but for ctx recreation due to resource change (drawable/window), // hence it must be called unconditional, always. listenersToBeInit.remove(listener); // remove if exist, avoiding dbl init - init( listener, drawable, true /* sendReshape */); + init( listener, drawable, sendReshape); } } } |