diff options
author | Sven Gothel <[email protected]> | 2011-08-09 20:22:34 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-08-09 20:22:34 +0200 |
commit | fefadb609d1135b0d5e13e9e872ca82fc2d7613c (patch) | |
tree | c31a8b9c664f28888a489e5f705ad124679b4c70 /src/jogl | |
parent | 78c66acc25a89687ae898a52f885de8dd8909dd7 (diff) | |
parent | 5500015001d6e6043959f5f0252c254632f0d381 (diff) |
Merge remote-tracking branch 'rsantina/master'
Diffstat (limited to 'src/jogl')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLRunnable.java | 6 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | 30 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLRunnableTask.java | 8 |
3 files changed, 29 insertions, 15 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLRunnable.java b/src/jogl/classes/javax/media/opengl/GLRunnable.java index de0f5df48..cbd086c77 100644 --- a/src/jogl/classes/javax/media/opengl/GLRunnable.java +++ b/src/jogl/classes/javax/media/opengl/GLRunnable.java @@ -41,7 +41,11 @@ public interface GLRunnable { /** * Called by the drawable to initiate one-shot OpenGL commands by the * client, like {@link GLEventListener#display(GLAutoDrawable)}. + * + * @param drawable the associated drawable the implementation shall use + * @return false if impl invalidates the back buffers, hence {@link GLAutoDrawable#display()} will + * issue another {@link GLEventListener#display(GLAutoDrawable)} call. Otherwise true. */ - void run(GLAutoDrawable drawable); + boolean run(GLAutoDrawable drawable); } 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 { diff --git a/src/jogl/classes/jogamp/opengl/GLRunnableTask.java b/src/jogl/classes/jogamp/opengl/GLRunnableTask.java index e5b66b985..448f68423 100644 --- a/src/jogl/classes/jogamp/opengl/GLRunnableTask.java +++ b/src/jogl/classes/jogamp/opengl/GLRunnableTask.java @@ -50,10 +50,11 @@ public class GLRunnableTask implements GLRunnable { isExecuted = false; } - public void run(GLAutoDrawable drawable) { + public boolean run(GLAutoDrawable drawable) { + boolean res = true; if(null == notifyObject) { try { - runnable.run(drawable); + res = runnable.run(drawable); } catch (Throwable t) { runnableException = t; if(catchExceptions) { @@ -67,7 +68,7 @@ public class GLRunnableTask implements GLRunnable { } else { synchronized (notifyObject) { try { - runnable.run(drawable); + res = runnable.run(drawable); } catch (Throwable t) { runnableException = t; if(catchExceptions) { @@ -81,6 +82,7 @@ public class GLRunnableTask implements GLRunnable { } } } + return res; } public boolean isExecuted() { return isExecuted; } |