diff options
author | Rami Santina <[email protected]> | 2011-08-09 20:51:12 +0300 |
---|---|---|
committer | Rami Santina <[email protected]> | 2011-08-09 20:51:12 +0300 |
commit | 91d3bf4ea69046684540402cb1fd46e70682a6c5 (patch) | |
tree | 5da0ca5116e82617fa7a7a7ff5c3c2a7bf30617a /src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | |
parent | f98a8e29b46b6cfbd2c3e695a02093b19468e95d (diff) |
GLRunnable API Change: Return boolean indicating whether the back buffer shall be updated before swap.
This allows color selection GLRunnables, executed after the GLEventListener.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLDrawableHelper.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index 887e571cc..9353479ab 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -156,16 +156,21 @@ public class GLDrawableHelper { } public final void display(GLAutoDrawable drawable) { - synchronized(listenersLock) { - for (int i=0; i < listeners.size(); i++) { - final GLEventListener listener = listeners.get(i) ; - // GLEventListener may need to be init, - // in case this one is added after the realization of the GLAutoDrawable - init( listener, drawable, true ) ; - listener.display(drawable); - } + displayImpl(drawable); + if(!execGLRunnables(drawable)) { + displayImpl(drawable); } - execGLRunnables(drawable); + } + private void displayImpl(GLAutoDrawable drawable) { + synchronized(listenersLock) { + for (int i=0; i < listeners.size(); i++) { + final GLEventListener listener = listeners.get(i) ; + // GLEventListener may need to be init, + // in case this one is added after the realization of the GLAutoDrawable + init( listener, drawable, true ) ; + listener.display(drawable); + } + } } private void reshape(GLEventListener listener, GLAutoDrawable drawable, @@ -184,7 +189,8 @@ public class GLDrawableHelper { } } - private void execGLRunnables(GLAutoDrawable drawable) { + private boolean execGLRunnables(GLAutoDrawable drawable) { + boolean res = true; if(glRunnables.size()>0) { // swap one-shot list asap ArrayList<GLRunnable> _glRunnables = null; @@ -194,12 +200,14 @@ public class GLDrawableHelper { glRunnables = new ArrayList<GLRunnable>(); } } + if(null!=_glRunnables) { for (int i=0; i < _glRunnables.size(); i++) { - _glRunnables.get(i).run(drawable); + res = _glRunnables.get(i).run(drawable) && res; } } } + return res; } public final void setAnimator(GLAnimatorControl animator) throws GLException { |