diff options
author | Sven Gothel <[email protected]> | 2010-10-27 16:27:35 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-10-27 16:27:35 +0200 |
commit | e6131c6b2cbf8d1e5a05f0343612f5083b55aaa9 (patch) | |
tree | 69f0425b9400408041859562448e10b354778527 /src | |
parent | a42017128a0e5a24b5852151efdf496059ca6a5d (diff) |
GLAnimatorControl/Animator: Allow stop() if paused()
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/Animator.java | 14 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLAnimatorControl.java | 4 |
2 files changed, 7 insertions, 11 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java index 2b8876a91..ecb3878ba 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java @@ -40,14 +40,10 @@ package com.jogamp.opengl.util; -import javax.media.opengl.GLAnimatorControl; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import com.jogamp.opengl.impl.Debug; -import java.util.*; /** <P> An Animator can be attached to one or more {@link @@ -154,9 +150,9 @@ public class Animator extends AnimatorBase { } } } - if ( !shouldStop ) { + if ( !shouldStop && !shouldPause) { display(); - if (!runAsFastAsPossible) { + if ( !runAsFastAsPossible) { // Avoid swamping the CPU Thread.yield(); } @@ -219,8 +215,8 @@ public class Animator extends AnimatorBase { public synchronized void stop() { boolean started = null != thread; - if ( !started || !isAnimating ) { - throw new GLException("Not running (started "+started+" (true), animating "+isAnimating+" (true) )"); + if ( !started ) { + throw new GLException("Not started"); } shouldStop = true; notifyAll(); @@ -230,7 +226,7 @@ public class Animator extends AnimatorBase { // use a couple of heuristics to determine whether we should do // the blocking wait(). if (!impl.skipWaitForCompletion(thread)) { - while (isAnimating && thread != null) { + while (thread != null) { try { wait(); } catch (InterruptedException ie) { diff --git a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java b/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java index 3aba634a0..01e5646f9 100644 --- a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java +++ b/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java @@ -129,7 +129,7 @@ public interface GLAnimatorControl { * @see #stop() * @see #isAnimating() * @see #getThread() - * @throws GLException if started and animating already + * @throws GLException if started already */ void start(); @@ -144,7 +144,7 @@ public interface GLAnimatorControl { * @see #start() * @see #isAnimating() * @see #getThread() - * @throws GLException if not started or not animating + * @throws GLException if not started */ void stop(); |