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/javax/media/opengl/GLAnimatorControl.java | |
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/javax/media/opengl/GLAnimatorControl.java')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLAnimatorControl.java | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java b/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java index 01e5646f9..98d7bc48b 100644 --- a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java +++ b/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java @@ -79,7 +79,7 @@ public interface GLAnimatorControl { public void resetCounter(); /** - * Indicates whether this animator is currently running, ie started. + * Indicates whether this animator is running, ie. has been started and not stopped. * * @see #start() * @see #stop() @@ -89,7 +89,8 @@ public interface GLAnimatorControl { boolean isStarted(); /** - * Indicates whether this animator is currently running and not paused. + * Indicates whether this animator is running and animating,<br> + * the latter is true if it has {@link GLAutoDrawable}s to render and is not paused. * * @see #start() * @see #stop() @@ -99,7 +100,7 @@ public interface GLAnimatorControl { boolean isAnimating(); /** - * Indicates whether this animator is currently running and paused. + * Indicates whether this animator is running and paused. * * @see #start() * @see #stop() @@ -109,7 +110,7 @@ public interface GLAnimatorControl { boolean isPaused(); /** - * @return The animation thread if started, ie running. + * @return The animation thread if running, otherwise null. * * @see #start() * @see #stop() @@ -158,7 +159,7 @@ public interface GLAnimatorControl { * * @see #resume() * @see #isAnimating() - * @throws GLException if not started or not animating or already paused + * @throws GLException if not started or already paused */ void pause(); @@ -177,4 +178,15 @@ public interface GLAnimatorControl { * @throws GLException if not started or not paused */ void resume(); + + /** + * Removes a drawable from the animator's list of rendering drawables.<br> + * This method should get called in case a drawable becomes invalid, + * and will not be recovered.<br> + * This allows the animator thread to become idle in case the last drawable + * has reached it's end of life.<br> + * + * @param drawable the to be removed drawable + */ + void remove(GLAutoDrawable drawable); } |