com.jogamp.opengl.util
Class AnimatorBase

java.lang.Object
  extended by com.jogamp.opengl.util.AnimatorBase
All Implemented Interfaces:
GLAnimatorControl
Direct Known Subclasses:
Animator, FPSAnimator

public abstract class AnimatorBase
extends Object
implements GLAnimatorControl

Base implementation of GLAnimatorControl

The change synchronization is done via synchronized blocks on the AnimatorBase instance.
Status get / set activity is synced with a RecursiveLock, used as a memory barrier.
This is suitable, since all change requests are allowed to be expensive as they are not expected to be called at every frame.


Nested Class Summary
static interface AnimatorBase.AnimatorImpl
           
 
Constructor Summary
AnimatorBase()
          Creates a new, empty Animator.
 
Method Summary
 void add(GLAutoDrawable drawable)
           
 long getCurrentTime()
           
 long getDuration()
           
 long getStartTime()
           
 Thread getThread()
           
 int getTotalFrames()
           
 void remove(GLAutoDrawable drawable)
          Removes a drawable from the animator's list of rendering drawables.
This method should get called in case a drawable becomes invalid, and will not be recovered.
This allows the animator thread to become idle in case the last drawable has reached it's end of life.
 void resetCounter()
          Reset all performance counter (startTime, currentTime, frame number)
 void setIgnoreExceptions(boolean ignoreExceptions)
          Sets a flag causing this Animator to ignore exceptions produced while redrawing the drawables.
 void setPrintExceptions(boolean printExceptions)
          Sets a flag indicating that when exceptions are being ignored by this Animator (see setIgnoreExceptions(boolean)), to print the exceptions' stack traces for diagnostic information.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.media.opengl.GLAnimatorControl
isAnimating, isPaused, isStarted, pause, resume, start, stop
 

Constructor Detail

AnimatorBase

public AnimatorBase()
Creates a new, empty Animator.

Method Detail

add

public void add(GLAutoDrawable drawable)

remove

public void remove(GLAutoDrawable drawable)
Description copied from interface: GLAnimatorControl
Removes a drawable from the animator's list of rendering drawables.
This method should get called in case a drawable becomes invalid, and will not be recovered.
This allows the animator thread to become idle in case the last drawable has reached it's end of life.

Specified by:
remove in interface GLAnimatorControl
Parameters:
drawable - the to be removed drawable

getCurrentTime

public long getCurrentTime()
Specified by:
getCurrentTime in interface GLAnimatorControl
Returns:
Time of the last display call in milliseconds. This value is reset if started or resumed.
See Also:
GLAnimatorControl.start(), GLAnimatorControl.resume()

getDuration

public long getDuration()
Specified by:
getDuration in interface GLAnimatorControl
Returns:
Duration getCurrentTime() - getStartTime().
See Also:
GLAnimatorControl.getStartTime(), GLAnimatorControl.getCurrentTime()

getStartTime

public long getStartTime()
Specified by:
getStartTime in interface GLAnimatorControl
Returns:
Time of the first display call in milliseconds. This value is reset if started or resumed.
See Also:
GLAnimatorControl.start(), GLAnimatorControl.resume()

getTotalFrames

public int getTotalFrames()
Specified by:
getTotalFrames in interface GLAnimatorControl
Returns:
Number of frame cycles displayed since the first display call, ie getStartTime(). This value is reset if started or resumed.
See Also:
GLAnimatorControl.start(), GLAnimatorControl.resume()

getThread

public final Thread getThread()
Specified by:
getThread in interface GLAnimatorControl
Returns:
The animation thread if running, otherwise null.
See Also:
GLAnimatorControl.start(), GLAnimatorControl.stop()

resetCounter

public void resetCounter()
Description copied from interface: GLAnimatorControl
Reset all performance counter (startTime, currentTime, frame number)

Specified by:
resetCounter in interface GLAnimatorControl

setIgnoreExceptions

public void setIgnoreExceptions(boolean ignoreExceptions)
Sets a flag causing this Animator to ignore exceptions produced while redrawing the drawables. By default this flag is set to false, causing any exception thrown to halt the Animator.


setPrintExceptions

public void setPrintExceptions(boolean printExceptions)
Sets a flag indicating that when exceptions are being ignored by this Animator (see setIgnoreExceptions(boolean)), to print the exceptions' stack traces for diagnostic information. Defaults to false.


toString

public String toString()
Overrides:
toString in class Object


Copyright 2010 JogAmp Community.