|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jogamp.opengl.util.AnimatorBase
public abstract class AnimatorBase
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
|
| Field Summary | |
|---|---|
static int |
MODE_EXPECT_AWT_RENDERING_THREAD
If present in modeBits field and
AWT is available,
implementation is aware of the AWT EDT, otherwise not. |
| Fields inherited from interface javax.media.opengl.FPSCounter |
|---|
DEFAULT_FRAMES_PER_INTERVAL |
| Constructor Summary | |
|---|---|
AnimatorBase()
Creates a new, empty Animator instance while expecting an AWT rendering thread if AWT is available. |
|
| Method Summary | |
|---|---|
void |
add(GLAutoDrawable drawable)
Adds a drawable to this animator's list of rendering drawables. |
Thread |
getExclusiveContextThread()
Returns the exclusive context thread if isExclusiveContextEnabled() and isStarted(), otherwise null. |
long |
getFPSStartTime()
Returns the time of the first display call in milliseconds after enabling this feature via FPSCounter.setUpdateFPSFrames(int, PrintStream).This value is reset via FPSCounter.resetFPSCounter(). |
float |
getLastFPS()
|
long |
getLastFPSPeriod()
|
long |
getLastFPSUpdateTime()
Returns the time of the last update interval in milliseconds, if this feature is enabled via FPSCounter.setUpdateFPSFrames(int, PrintStream).This value is reset via FPSCounter.resetFPSCounter(). |
int |
getModeBits()
|
Thread |
getThread()
|
float |
getTotalFPS()
|
long |
getTotalFPSDuration()
|
int |
getTotalFPSFrames()
|
int |
getUpdateFPSFrames()
|
boolean |
isExclusiveContextEnabled()
Returns true, if the exclusive context thread is enabled, otherwise false. |
boolean |
isStarted()
Indicates whether this animator has been started. |
void |
remove(GLAutoDrawable drawable)
Removes a drawable from the animator's list of rendering drawables. |
void |
resetFPSCounter()
Reset all performance counter (startTime, currentTime, frame number) |
boolean |
setExclusiveContext(boolean enable)
Dedicate all GLAutoDrawable's context to this animator thread. |
Thread |
setExclusiveContext(Thread t)
Dedicate all GLAutoDrawable's context to the given exclusive context thread. |
void |
setIgnoreExceptions(boolean ignoreExceptions)
Sets a flag causing this Animator to ignore exceptions produced while redrawing the drawables. |
void |
setModeBits(boolean enable,
int bitValues)
Enables or disables the given bitValues
in this Animators modeBits. |
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 |
setUpdateFPSFrames(int frames,
PrintStream out)
|
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, pause, resume, start, stop |
| Field Detail |
|---|
public static final int MODE_EXPECT_AWT_RENDERING_THREAD
modeBits field and
AWT is available,
implementation is aware of the AWT EDT, otherwise not.
This is the default.
setModeBits(boolean, int),
Constant Field Values| Constructor Detail |
|---|
public AnimatorBase()
GLProfile.isAWTAvailable()| Method Detail |
|---|
public final void setModeBits(boolean enable,
int bitValues)
throws GLException
bitValues
in this Animators modeBits.
enable - bitValues -
GLException - if Animator is isStarted() and MODE_EXPECT_AWT_RENDERING_THREAD about to changeMODE_EXPECT_AWT_RENDERING_THREADpublic int getModeBits()
public final void add(GLAutoDrawable drawable)
GLAnimatorControl
This allows the animator thread to become animating,
in case the first drawable is added and the animator is started.
add in interface GLAnimatorControldrawable - the drawable to be addedpublic final void remove(GLAutoDrawable drawable)
GLAnimatorControlThis method should get called in case a drawable becomes invalid, and will not be recovered.
This allows the animator thread to become not animating,
in case the last drawable has been removed.
remove in interface GLAnimatorControldrawable - the drawable to be removedpublic final Thread setExclusiveContext(Thread t)
GLAutoDrawable's context to the given exclusive context thread.
The given thread will be exclusive to all GLAutoDrawable's context while GLAnimatorControl.isAnimating().
If already started and disabling, method waits
until change is propagated to all GLAutoDrawable if not
called from the animator thread or exclusive context thread.
Note: Utilizing this feature w/ AWT could lead to an AWT-EDT deadlock, depending on the AWT implementation. Hence it is advised not to use it with native AWT GLAutoDrawable like GLCanvas.
enable -
setExclusiveContext(boolean),
getExclusiveContextThread(),
isExclusiveContextEnabled()public final boolean setExclusiveContext(boolean enable)
GLAutoDrawable's context to this animator thread.
The given thread will be exclusive to all GLAutoDrawable's context while GLAnimatorControl.isAnimating().
If already started and disabling, method waits
until change is propagated to all GLAutoDrawable if not
called from the animator thread or exclusive context thread.
Note: Utilizing this feature w/ AWT could lead to an AWT-EDT deadlock, depending on the AWT implementation. Hence it is advised not to use it with native AWT GLAutoDrawable like GLCanvas.
enable -
setExclusiveContext(Thread),
getExclusiveContextThread(),
isExclusiveContextEnabled()public final boolean isExclusiveContextEnabled()
true, if the exclusive context thread is enabled, otherwise false.
setExclusiveContext(boolean),
setExclusiveContext(Thread)public final Thread getExclusiveContextThread()
isExclusiveContextEnabled() and isStarted(), otherwise null.
If exclusive context is enabled via setExclusiveContext(boolean)
the animator thread is returned if above conditions are met.
If exclusive context is enabled via setExclusiveContext(Thread)
the user passed thread is returned if above conditions are met.
setExclusiveContext(boolean),
setExclusiveContext(Thread)public final Thread getThread()
getThread in interface GLAnimatorControlGLAnimatorControl.start(),
GLAnimatorControl.stop()
public final void setUpdateFPSFrames(int frames,
PrintStream out)
setUpdateFPSFrames in interface FPSCounterframes - Update interval in frames.FPSCounter.DEFAULT_FRAMES_PER_INTERVAL.out - optional print stream where the fps values gets printed if not null at every frames intervalpublic final void resetFPSCounter()
FPSCounter
resetFPSCounter in interface FPSCounterpublic final int getUpdateFPSFrames()
getUpdateFPSFrames in interface FPSCounterFPSCounter.setUpdateFPSFrames(int, PrintStream)public final long getFPSStartTime()
FPSCounterFPSCounter.setUpdateFPSFrames(int, PrintStream).FPSCounter.resetFPSCounter().
getFPSStartTime in interface FPSCounterFPSCounter.setUpdateFPSFrames(int, PrintStream),
FPSCounter.resetFPSCounter()public final long getLastFPSUpdateTime()
FPSCounterFPSCounter.setUpdateFPSFrames(int, PrintStream).FPSCounter.resetFPSCounter().
getLastFPSUpdateTime in interface FPSCounterFPSCounter.setUpdateFPSFrames(int, PrintStream),
FPSCounter.resetFPSCounter()public final long getLastFPSPeriod()
getLastFPSPeriod in interface FPSCounterFPSCounter.setUpdateFPSFrames(int, PrintStream),
FPSCounter.resetFPSCounter()public final float getLastFPS()
getLastFPS in interface FPSCounterFPSCounter.getUpdateFPSFrames() / FPSCounter.getLastFPSPeriod()FPSCounter.setUpdateFPSFrames(int, PrintStream),
FPSCounter.resetFPSCounter()public final int getTotalFPSFrames()
getTotalFPSFrames in interface FPSCounterFPSCounter.getFPSStartTime() up to FPSCounter.getLastFPSUpdateTime()FPSCounter.setUpdateFPSFrames(int, PrintStream),
FPSCounter.resetFPSCounter()public final long getTotalFPSDuration()
getTotalFPSDuration in interface FPSCounterFPSCounter.getLastFPSUpdateTime() - FPSCounter.getFPSStartTime()FPSCounter.setUpdateFPSFrames(int, PrintStream),
FPSCounter.resetFPSCounter()public final float getTotalFPS()
getTotalFPS in interface FPSCounterFPSCounter.getTotalFPSFrames() / FPSCounter.getTotalFPSDuration()FPSCounter.setUpdateFPSFrames(int, PrintStream),
FPSCounter.resetFPSCounter()public final void setIgnoreExceptions(boolean ignoreExceptions)
public final void setPrintExceptions(boolean printExceptions)
setIgnoreExceptions(boolean)), to print the
exceptions' stack traces for diagnostic information. Defaults to
false.
public boolean isStarted()
GLAnimatorControlstarted.
isStarted in interface GLAnimatorControlGLAnimatorControl.start(),
GLAnimatorControl.stop(),
GLAnimatorControl.isPaused(),
GLAnimatorControl.pause(),
GLAnimatorControl.resume()public String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||