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.UncaughtAnimatorException
Nested 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_THREAD
Fields 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 int
getFPS()
final boolean
Indicates whether this animatoris started
andis not paused
.final boolean
isPaused()
Indicates whether this animatoris started
and eithermanually paused
or paused automatically due to noadded
GLAutoDrawable
s.final boolean
pause()
Pauses this animator.final boolean
resume()
Resumes animation if paused.final void
setFPS
(int fps) final boolean
start()
Starts this animator, if not running.final boolean
stop()
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:GLAnimatorControl
Indicates whether this animatoris started
andis not paused
. -
isPaused
public final boolean isPaused()Description copied from interface:GLAnimatorControl
Indicates whether this animatoris started
and eithermanually paused
or paused automatically due to noadded
GLAutoDrawable
s. -
start
public final boolean 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.
Note that an animator w/o
added drawables
will 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: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.
- Returns:
- false if not started, already paused or failed to pause, otherwise true
- See Also:
-
resume
public final boolean 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.
- Returns:
- false if not started, not paused or unable to resume, otherwise true
- See Also:
-