From e6131c6b2cbf8d1e5a05f0343612f5083b55aaa9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 27 Oct 2010 16:27:35 +0200 Subject: GLAnimatorControl/Animator: Allow stop() if paused() --- src/jogl/classes/com/jogamp/opengl/util/Animator.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/jogl/classes/com') 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.*; /**

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) { -- cgit v1.2.3