diff options
author | Sven Gothel <[email protected]> | 2010-11-21 03:41:22 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-11-21 03:41:22 +0100 |
commit | 2aa296771e3e8dd6cf027f27b0455d1803244bfe (patch) | |
tree | 514c532f9ddff7f84e9e6fb75e883f04c71ec74f /src/jogl/classes/com/jogamp/opengl/impl | |
parent | 6f73de7c5bb85d0175c8dda7c55317923017bbe0 (diff) |
JOGL/NEWT: Animator fixes
Consider use cases with many drawables and no drawables at start,
this had to be reflected all over this patch set, implementation,
usage and test cases.
- GLAnimatorControl
- refine API doc / states
- add 'void remove(GLAutoDrawable drawable);'
- Animator*:
- using RecursiveLock 'stateSync' for all actions out of the big synchronized (animator) block:
- get status methods (thread, isPaused, ..), hence no more synchronized
- display drawables change, utilizing synced ArrayList swap
This removes the need for volatiles usage shouldPause/shouldStop within the display method.
- added blocking wait for state change for add(GLAutoDrawable)/remove(GLAutoDrawable) method
- remove flawed double checked locking in anim thread (pause/idle condition)
- thread is now a daemon thread, hence it won't hinder the JVM from shutdown
-
- Animator use change:
- Always resume after pause, except in case of final destroy -> NEWT invalidate / GLCanvas,
this considers use cases with many drawables and no drawables at start.
- GLDrawableHelper: Don't pause at implicit dispose()
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java index 5b1858c41..45b04fac1 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java @@ -238,6 +238,10 @@ public class GLDrawableHelper { } } + public final boolean isExternalAnimatorRunning() { + return ( null != animatorCtrl ) ? animatorCtrl.isStarted() && animatorCtrl.getThread() != Thread.currentThread() : false ; + } + public final boolean isExternalAnimatorAnimating() { return ( null != animatorCtrl ) ? animatorCtrl.isAnimating() && animatorCtrl.getThread() != Thread.currentThread() : false ; } @@ -298,8 +302,6 @@ public class GLDrawableHelper { * <br> * Remark: In case this method is called to dispose the GLDrawable/GLAutoDrawable, * <code>initAction</code> shall be <code>null</code> to mark this cause.<br> - * In this case, the locally delegated {@link javax.media.opengl.GLAnimatorControl} via {@link #setAnimator(javax.media.opengl.GLAnimatorControl) setAnimator(animatorControl)} - * is paused first, if {@link javax.media.opengl.GLAnimatorControl#isAnimating()}. * * @param drawable * @param context @@ -323,10 +325,6 @@ public class GLDrawableHelper { if(!context.isCreated()) { throw new GLException("Dispose case (no init action given): Native context must be created: "+context); } - GLAnimatorControl animCtrl = getAnimator(); - if(null!=animCtrl && animCtrl.isAnimating()) { - animCtrl.pause(); - } } // Support for recursive makeCurrent() calls as well as calling |