com.sun.opengl.util

Class FPSAnimator


public class FPSAnimator
extends Animator

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.

Field Summary

Fields inherited from class com.sun.opengl.util.Animator

ignoreExceptions, printExceptions

Constructor Summary

FPSAnimator(int fps)
Creates an FPSAnimator with a given target frames-per-second value.
FPSAnimator(int fps, boolean scheduleAtFixedRate)
Creates an FPSAnimator with a given target frames-per-second value and a flag indicating whether to use fixed-rate scheduling.
FPSAnimator(GLAutoDrawable drawable, int fps)
Creates an FPSAnimator with a given target frames-per-second value and an initial drawable to animate.
FPSAnimator(GLAutoDrawable drawable, int fps, boolean scheduleAtFixedRate)
Creates an FPSAnimator with a given target frames-per-second value, an initial drawable to animate, and a flag indicating whether to use fixed-rate scheduling.

Method Summary

boolean
isAnimating()
Indicates whether this FPSAnimator is currently running.
void
start()
Starts this FPSAnimator.
void
stop()
Stops this FPSAnimator.

Methods inherited from class com.sun.opengl.util.Animator

add, display, drawableIterator, isAnimating, remove, setIgnoreExceptions, setPrintExceptions, setRunAsFastAsPossible, start, stop

Constructor Details

FPSAnimator

public FPSAnimator(int fps)
Creates an FPSAnimator with a given target frames-per-second value. Equivalent to FPSAnimator(null, fps).

FPSAnimator

public FPSAnimator(int fps,
                   boolean scheduleAtFixedRate)
Creates an FPSAnimator with a given target frames-per-second value and a flag indicating whether to use fixed-rate scheduling. Equivalent to FPSAnimator(null, fps, scheduleAtFixedRate).

FPSAnimator

public FPSAnimator(GLAutoDrawable drawable,
                   int fps)
Creates an FPSAnimator with a given target frames-per-second value and an initial drawable to animate. Equivalent to FPSAnimator(null, fps, false).

FPSAnimator

public FPSAnimator(GLAutoDrawable drawable,
                   int fps,
                   boolean scheduleAtFixedRate)
Creates an FPSAnimator with a given target frames-per-second value, an initial drawable to animate, and a flag indicating whether to use fixed-rate scheduling.

Method Details

isAnimating

public boolean isAnimating()
Indicates whether this FPSAnimator is currently running. This should only be used as a heuristic to applications because in some circumstances the FPSAnimator may be in the process of shutting down and this method will still return true.
Overrides:
isAnimating in interface Animator

start

public void start()
Starts this FPSAnimator.
Overrides:
start in interface Animator

stop

public void stop()
Stops this FPSAnimator. Due to the implementation of the FPSAnimator it is not guaranteed that the FPSAnimator will be completely stopped by the time this method returns.
Overrides:
stop in interface Animator

Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.