From 3169bfb049053220118e5cec904a1bfaa181c07d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 28 Feb 2011 23:55:04 +0100 Subject: Animator: Cleanup and better DEBUG info --- src/jogl/classes/com/jogamp/opengl/util/Animator.java | 13 ++++++++----- src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src/jogl/classes/com/jogamp') diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java index fed55aeef..4fbd0e478 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java @@ -41,7 +41,6 @@ package com.jogamp.opengl.util; import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLException; /**

An Animator can be attached to one or more {@link @@ -125,11 +124,15 @@ public class Animator extends AnimatorBase { } class MainLoop implements Runnable { + public String toString() { + return "[started "+isStartedImpl()+", animating "+isAnimatingImpl()+", paused "+isPausedImpl()+", frames "+getTotalFrames()+", drawable "+drawables.size()+"]"; + } + public void run() { try { synchronized (Animator.this) { if(DEBUG) { - System.err.println("Animator started: "+Thread.currentThread()); + System.err.println("Animator start:" + Thread.currentThread() + ": " + toString()); } startTime = System.currentTimeMillis(); @@ -147,7 +150,7 @@ public class Animator extends AnimatorBase { while (!stopIssued && (pauseIssued || drawablesEmpty)) { boolean wasPaused = pauseIssued; if (DEBUG) { - System.err.println("Animator paused: " + Thread.currentThread()); + System.err.println("Animator pause:" + Thread.currentThread() + ": " + toString()); } setIsAnimatingSynced(false); // barrier Animator.this.notifyAll(); @@ -162,7 +165,7 @@ public class Animator extends AnimatorBase { curTime = startTime; totalFrames = 0; if (DEBUG) { - System.err.println("Animator resume: " + Thread.currentThread()); + System.err.println("Animator resume:" + Thread.currentThread() + ": " + toString()); } } } @@ -184,7 +187,7 @@ public class Animator extends AnimatorBase { } finally { synchronized (Animator.this) { if(DEBUG) { - System.err.println("Animator stopped: "+Thread.currentThread()); + System.err.println("Animator stop " + Thread.currentThread() + ": " + toString()); } stopIssued = false; pauseIssued = false; diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java index 4a8579767..01c2ea664 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java +++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java @@ -111,7 +111,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { public synchronized void remove(GLAutoDrawable drawable) { if(DEBUG) { - System.err.println("Animator remove: "+drawable.hashCode()+" - "+Thread.currentThread()); + System.err.println("Animator remove: "+drawable.hashCode()+" - "+Thread.currentThread() + ": "+toString()); } boolean paused = pause(); -- cgit v1.2.3