Contents / Previous / Next


Animator Class (import com.sun.opengl.util.Animator)

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.


Constructor Summary
Animator()
          Creates a new, empty Animator.
Animator(GLAutoDrawable drawable)
          Creates a new Animator for a particular drawable.
 
Method Summary
 void add(GLAutoDrawable drawable)
          Adds a drawable to the list managed by this Animator.
protected  void display()
          Called every frame to cause redrawing of all of the GLAutoDrawables this Animator manages.
 Iterator drawableIterator()
          Returns an iterator over the drawables managed by this Animator.
 boolean isAnimating()
          Indicates whether this animator is currently running.
 void remove(GLAutoDrawable drawable)
          Removes a drawable from the list managed by this Animator.
 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.
 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.
 void stop()


FPSAnimator(int fps) is an Animator subclass which attempts to achieve a target frames-per-second rate to avoid using all CPU time. The target FPS is only an estimate and is not guaranteed.