Class FPSAnimator
- All Implemented Interfaces:
FPSCounter,GLAnimatorControl
The Animator execution thread does not run as a daemon thread,
so it is able to keep an application from terminating.
Call stop() to terminate the animation and it's execution thread.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.jogamp.opengl.util.AnimatorBase
AnimatorBase.AnimatorImpl, AnimatorBase.UncaughtAnimatorExceptionNested classes/interfaces inherited from interface com.jogamp.opengl.GLAnimatorControl
GLAnimatorControl.UncaughtExceptionHandler -
Field Summary
Fields inherited from class com.jogamp.opengl.util.AnimatorBase
MODE_EXPECT_AWT_RENDERING_THREADFields inherited from interface com.jogamp.opengl.FPSCounter
DEFAULT_FRAMES_PER_INTERVAL -
Constructor Summary
ConstructorsConstructorDescriptionFPSAnimator(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
Modifier and TypeMethodDescriptionfinal intgetFPS()final booleanIndicates whether this animatoris startedandis not paused.final booleanisPaused()Indicates whether this animatoris startedand eithermanually pausedor paused automatically due to noaddedGLAutoDrawables.final booleanpause()Pauses this animator.final booleanresume()Resumes animation if paused.final voidsetFPS(int fps) final booleanstart()Starts this animator, if not running.final booleanstop()Stops this FPSAnimator.Methods inherited from class com.jogamp.opengl.util.AnimatorBase
add, getExclusiveContextThread, getFPSStartTime, getLastFPS, getLastFPSPeriod, getLastFPSUpdateTime, getModeBits, getThread, getTotalFPS, getTotalFPSDuration, getTotalFPSFrames, getUncaughtExceptionHandler, getUpdateFPSFrames, isExclusiveContextEnabled, isStarted, remove, resetFPSCounter, setExclusiveContext, setExclusiveContext, setIgnoreExceptions, setModeBits, setPrintExceptions, setUncaughtExceptionHandler, setUpdateFPSFrames, toString
-
Constructor Details
-
FPSAnimator
public FPSAnimator(int fps) Creates an FPSAnimator with a given target frames-per-second value. Equivalent toFPSAnimator(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 toFPSAnimator(null, fps, scheduleAtFixedRate). -
FPSAnimator
Creates an FPSAnimator with a given target frames-per-second value and an initial drawable to animate. Equivalent toFPSAnimator(null, fps, false). -
FPSAnimator
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
-
setFPS
- Parameters:
fps-- Throws:
GLException- if the animator has already been started
-
getFPS
public final int getFPS() -
isAnimating
public final boolean isAnimating()Description copied from interface:GLAnimatorControlIndicates whether this animatoris startedandis not paused. -
isPaused
public final boolean isPaused()Description copied from interface:GLAnimatorControlIndicates whether this animatoris startedand eithermanually pausedor paused automatically due to noaddedGLAutoDrawables. -
start
public final boolean start()Description copied from interface:GLAnimatorControlStarts 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.
Note that an animator w/o
added drawableswill be paused automatically.If started, all counters (time, frames, ..) are reset to zero.
- Returns:
- true is started due to this call, otherwise false, ie started already or unable to start.
- See Also:
-
stop
public final boolean 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.- Returns:
- true is stopped due to this call, otherwise false, ie not started or unable to stop.
- See Also:
-
pause
public final boolean pause()Description copied from interface:GLAnimatorControlPauses 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.
- Returns:
- false if not started, already paused or failed to pause, otherwise true
- See Also:
-
resume
public final boolean resume()Description copied from interface:GLAnimatorControlResumes 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.
- Returns:
- false if not started, not paused or unable to resume, otherwise true
- See Also:
-