com.jogamp.opengl.util
Class Animator

java.lang.Object
  extended by com.jogamp.opengl.util.AnimatorBase
      extended by com.jogamp.opengl.util.Animator
All Implemented Interfaces:
GLAnimatorControl

public class Animator
extends AnimatorBase

An Animator can be attached to one or more GLAutoDrawables to drive their display() methods in a loop.

The Animator class creates a background thread in which the calls to display() are performed. After each drawable has been redrawn, a brief pause is performed to avoid swamping the CPU, unless setRunAsFastAsPossible(boolean) has been called.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.jogamp.opengl.util.AnimatorBase
AnimatorBase.AnimatorImpl
 
Constructor Summary
Animator()
           
Animator(GLAutoDrawable drawable)
          Creates a new Animator for a particular drawable.
Animator(ThreadGroup tg)
           
Animator(ThreadGroup tg, GLAutoDrawable drawable)
          Creates a new Animator for a particular drawable.
 
Method Summary
 boolean isAnimating()
          Indicates whether this animator is currently running and not paused.
 boolean isPaused()
          Indicates whether this animator is currently running and paused.
 boolean isStarted()
          Indicates whether this animator is currently running, ie started.
 void pause()
          Pauses this animator.
 void resume()
          Resumes animation if paused.
 void setRunAsFastAsPossible(boolean runFast)
          Sets a flag in this Animator indicating that it is to run as fast as possible.
 void start()
          Starts this animator, if not running.
 void stop()
          Stops this animator.
 
Methods inherited from class com.jogamp.opengl.util.AnimatorBase
acquireDrawables, add, getCurrentTime, getDuration, getStartTime, getThread, getTotalFrames, releaseDrawables, remove, resetCounter, setIgnoreExceptions, setPrintExceptions, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Animator

public Animator()

Animator

public Animator(ThreadGroup tg)

Animator

public Animator(GLAutoDrawable drawable)
Creates a new Animator for a particular drawable.


Animator

public Animator(ThreadGroup tg,
                GLAutoDrawable drawable)
Creates a new Animator for a particular drawable.

Method Detail

setRunAsFastAsPossible

public final void setRunAsFastAsPossible(boolean runFast)
Sets a flag in this Animator indicating that it is to run as fast as possible. By default there is a brief pause in the animation loop which prevents the CPU from getting swamped. This method may not have an effect on subclasses.


isStarted

public final boolean isStarted()
Description copied from interface: GLAnimatorControl
Indicates whether this animator is currently running, ie started.

See Also:
GLAnimatorControl.start(), GLAnimatorControl.stop(), GLAnimatorControl.pause(), GLAnimatorControl.resume()

isAnimating

public final boolean isAnimating()
Description copied from interface: GLAnimatorControl
Indicates whether this animator is currently running and not paused.

See Also:
GLAnimatorControl.start(), GLAnimatorControl.stop(), GLAnimatorControl.pause(), GLAnimatorControl.resume()

isPaused

public final boolean isPaused()
Description copied from interface: GLAnimatorControl
Indicates whether this animator is currently running and paused.

See Also:
GLAnimatorControl.start(), GLAnimatorControl.stop(), GLAnimatorControl.pause(), GLAnimatorControl.resume()

start

public void start()
Description copied from interface: GLAnimatorControl
Starts this animator, if not running.

In most situations this method blocks until completion, except when called from the animation thread itself or in some cases from an implementation-internal thread like the AWT event queue thread.

If started, all counters (time, frames, ..) are reset to zero.

See Also:
GLAnimatorControl.stop(), GLAnimatorControl.isAnimating(), GLAnimatorControl.getThread()

stop

public void stop()
Description copied from interface: GLAnimatorControl
Stops this animator.

In most situations this method blocks until completion, except when called from the animation thread itself or in some cases from an implementation-internal thread like the AWT event queue thread.

See Also:
GLAnimatorControl.start(), GLAnimatorControl.isAnimating(), GLAnimatorControl.getThread()

pause

public void pause()
Description copied from interface: GLAnimatorControl
Pauses this animator.

In most situations this method blocks until completion, except when called from the animation thread itself or in some cases from an implementation-internal thread like the AWT event queue thread.

See Also:
GLAnimatorControl.resume(), GLAnimatorControl.isAnimating()

resume

public void resume()
Description copied from interface: GLAnimatorControl
Resumes animation if paused.

In most situations this method blocks until completion, except when called from the animation thread itself or in some cases from an implementation-internal thread like the AWT event queue thread.

If resumed, all counters (time, frames, ..) are reset to zero.

See Also:
GLAnimatorControl.pause(), GLAnimatorControl.isAnimating()


Copyright 2010 JogAmp Community.