diff options
author | Sven Gothel <[email protected]> | 2011-04-23 06:20:45 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-04-23 06:20:45 +0200 |
commit | ea819ff768d507c37a981c1ab0bdc0cad32c6a87 (patch) | |
tree | 769f0b3c394fb93da235cd7abf6bdd7f642be42a /src/jogl/classes/com/jogamp/opengl/util/Animator.java | |
parent | f5e0656fe20925d8c921d1b4cc70acd02dfbf9fd (diff) |
New FPSCounter, impl. by GLWindow and GLAnimatorControl (fps perf related API change)
- Don't fetch System.currentTimeMillis() by default and for every frame (performance)
- Default behavior is FPSCounter switched off
- Enable by frame interval, ie measure each 60 frames.
- FPSCounterImpl is default impl. used by impl. FPSCounter class (reduce code/redundancy)
- Might be promoted to GLAutoDrawable ?!
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util/Animator.java')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/Animator.java | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java index 4fbd0e478..e7fbc4d58 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java @@ -125,7 +125,7 @@ public class Animator extends AnimatorBase { class MainLoop implements Runnable { public String toString() { - return "[started "+isStartedImpl()+", animating "+isAnimatingImpl()+", paused "+isPausedImpl()+", frames "+getTotalFrames()+", drawable "+drawables.size()+"]"; + return "[started "+isStartedImpl()+", animating "+isAnimatingImpl()+", paused "+isPausedImpl()+", drawable "+drawables.size()+"]"; } public void run() { @@ -134,11 +134,7 @@ public class Animator extends AnimatorBase { if(DEBUG) { System.err.println("Animator start:" + Thread.currentThread() + ": " + toString()); } - - startTime = System.currentTimeMillis(); - curTime = startTime; - totalFrames = 0; - + fpsCounter.resetFPSCounter(); animThread = Thread.currentThread(); setIsAnimatingSynced(false); // barrier Animator.this.notifyAll(); @@ -161,9 +157,7 @@ public class Animator extends AnimatorBase { if (wasPaused) { // resume from pause -> reset counter - startTime = System.currentTimeMillis(); - curTime = startTime; - totalFrames = 0; + fpsCounter.resetFPSCounter(); if (DEBUG) { System.err.println("Animator resume:" + Thread.currentThread() + ": " + toString()); } @@ -269,7 +263,7 @@ public class Animator extends AnimatorBase { if (runnable == null) { runnable = new MainLoop(); } - resetCounter(); + fpsCounter.resetFPSCounter(); String threadName = Thread.currentThread().getName()+"-"+baseName; Thread thread; if(null==threadGroup) { |