|
JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java (public API).
|
Base implementation of GLAnimatorControl
More...
Classes | |
| interface | AnimatorImpl |
| interface | Condition |
| class | UncaughtAnimatorException |
Public Member Functions | |
| AnimatorBase () | |
| Creates a new, empty Animator instance while expecting an AWT rendering thread if AWT is available. More... | |
| AnimatorBase (final int modeBits) | |
| Creates a new, empty Animator instance with given modeBits. More... | |
| final synchronized void | setModeBits (final boolean enable, final int bitValues) throws GLException |
Enables or disables the given bitValues in this Animators modeBits. More... | |
| synchronized int | getModeBits () |
| final synchronized void | add (final GLAutoDrawable drawable) |
| Adds a drawable to this animator's list of rendering drawables. More... | |
| final synchronized void | remove (final GLAutoDrawable drawable) |
| Removes a drawable from the animator's list of rendering drawables. More... | |
| final synchronized Thread | setExclusiveContext (final Thread t) |
Dedicate all GLAutoDrawable's context to the given exclusive context thread. More... | |
| final boolean | setExclusiveContext (final boolean enable) |
Dedicate all GLAutoDrawable's context to this animator thread. More... | |
| final synchronized boolean | isExclusiveContextEnabled () |
Returns true, if the exclusive context thread is enabled, otherwise false. More... | |
| final synchronized Thread | getExclusiveContextThread () |
Returns the exclusive context thread if isExclusiveContextEnabled() and isStarted(), otherwise null. More... | |
| final synchronized Thread | getThread () |
| final void | setUpdateFPSFrames (final int frames, final PrintStream out) |
| final void | resetFPSCounter () |
| Reset all performance counter (startTime, currentTime, frame number) More... | |
| final int | getUpdateFPSFrames () |
| final long | getFPSStartTime () |
Returns the time of the first display call in milliseconds after enabling this feature via setUpdateFPSFrames(int, PrintStream). More... | |
| final long | getLastFPSUpdateTime () |
Returns the time of the last update interval in milliseconds, if this feature is enabled via setUpdateFPSFrames(int, PrintStream). More... | |
| final long | getLastFPSPeriod () |
| final float | getLastFPS () |
| final int | getTotalFPSFrames () |
| final long | getTotalFPSDuration () |
| final float | getTotalFPS () |
| final void | setIgnoreExceptions (final boolean ignoreExceptions) |
| Sets a flag causing this Animator to ignore exceptions produced while redrawing the drawables. More... | |
| final void | setPrintExceptions (final boolean printExceptions) |
Sets a flag indicating that when exceptions are being ignored by this Animator (see setIgnoreExceptions), to print the exceptions' stack traces for diagnostic information. More... | |
| final UncaughtExceptionHandler | getUncaughtExceptionHandler () |
Returns the UncaughtExceptionHandler invoked when this animator abruptly stops due to an uncaught exception from one of its GLAutoDrawables. More... | |
| final void | setUncaughtExceptionHandler (final UncaughtExceptionHandler handler) |
Set the handler invoked when this animator abruptly stops due to an uncaught exception from one of its GLAutoDrawables. More... | |
| synchronized boolean | isStarted () |
Indicates whether this animator has been started. More... | |
| String | toString () |
Public Member Functions inherited from com.jogamp.opengl.GLAnimatorControl | |
| boolean | isStarted () |
Indicates whether this animator has been started. More... | |
| boolean | isAnimating () |
Indicates whether this animator is started and is not paused. More... | |
| boolean | isPaused () |
Indicates whether this animator is started and either manually paused or paused automatically due to no added GLAutoDrawables. More... | |
| Thread | getThread () |
| boolean | start () |
| Starts this animator, if not running. More... | |
| boolean | stop () |
| Stops this animator. More... | |
| boolean | pause () |
| Pauses this animator. More... | |
| boolean | resume () |
| Resumes animation if paused. More... | |
| void | add (GLAutoDrawable drawable) |
| Adds a drawable to this animator's list of rendering drawables. More... | |
| void | remove (GLAutoDrawable drawable) |
| Removes a drawable from the animator's list of rendering drawables. More... | |
| UncaughtExceptionHandler | getUncaughtExceptionHandler () |
Returns the UncaughtExceptionHandler invoked when this animator abruptly stops due to an uncaught exception from one of its GLAutoDrawables. More... | |
| void | setUncaughtExceptionHandler (final UncaughtExceptionHandler handler) |
Set the handler invoked when this animator abruptly stops due to an uncaught exception from one of its GLAutoDrawables. More... | |
| void | setUpdateFPSFrames (int frames, PrintStream out) |
| void | resetFPSCounter () |
| Reset all performance counter (startTime, currentTime, frame number) More... | |
| int | getUpdateFPSFrames () |
| long | getFPSStartTime () |
Returns the time of the first display call in milliseconds after enabling this feature via setUpdateFPSFrames(int, PrintStream). More... | |
| long | getLastFPSUpdateTime () |
Returns the time of the last update interval in milliseconds, if this feature is enabled via setUpdateFPSFrames(int, PrintStream). More... | |
| long | getLastFPSPeriod () |
| float | getLastFPS () |
| int | getTotalFPSFrames () |
| long | getTotalFPSDuration () |
| float | getTotalFPS () |
Static Public Attributes | |
| static final int | MODE_EXPECT_AWT_RENDERING_THREAD = 1 << 0 |
If present in modeBits field and AWT is available, implementation is aware of the AWT EDT, otherwise not. More... | |
Static Public Attributes inherited from com.jogamp.opengl.FPSCounter | |
| static final int | DEFAULT_FRAMES_PER_INTERVAL = 5*60 |
Protected Member Functions | |
| final synchronized void | initImpl (final boolean force) |
Initializes implementation details post setup, invoked at add(GLAutoDrawable), start(), . More... | |
| abstract String | getBaseName (String prefix) |
| final synchronized void | setDrawablesExclCtxState (final boolean enable) |
Should be called at start() and stop() from within the animator thread. More... | |
| final boolean | validateDrawablesExclCtxState (final Thread expected) |
| final void | display () throws UncaughtAnimatorException |
| Called every frame to cause redrawing of all of the GLAutoDrawables this Animator manages. More... | |
| final synchronized boolean | handleUncaughtException (final UncaughtAnimatorException ue) |
| Should be called in case of an uncaught exception from within the animator thread, throws given exception if no handler has been installed. More... | |
| final void | flushGLRunnables () |
| Should be called in case of an uncaught exception from within the animator thread to flush all animator. More... | |
| final synchronized boolean | finishLifecycleAction (final Condition waitCondition, long pollPeriod) |
Static Protected Member Functions | |
| static String | getThreadName () |
Protected Attributes | |
| int | modeBits |
| AnimatorImpl | impl |
| String | baseName |
| ArrayList< GLAutoDrawable > | drawables = new ArrayList<GLAutoDrawable>() |
| boolean | drawablesEmpty |
| Thread | animThread |
| boolean | ignoreExceptions |
| boolean | printExceptions |
| boolean | exclusiveContext |
| Thread | userExclusiveContextThread |
| UncaughtExceptionHandler | uncaughtExceptionHandler |
| FPSCounterImpl | fpsCounter = new FPSCounterImpl() |
Static Protected Attributes | |
| static final boolean | DEBUG = Debug.debug("Animator") |
| static final long | TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION = 1000 |
A 1s timeout while waiting for a native action response, limiting finishLifecycleAction(Condition, long). More... | |
| static final long | POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION = 32 |
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.
Definition at line 55 of file AnimatorBase.java.
| com.jogamp.opengl.util.AnimatorBase.AnimatorBase | ( | ) |
Creates a new, empty Animator instance while expecting an AWT rendering thread if AWT is available.
Definition at line 136 of file AnimatorBase.java.
| com.jogamp.opengl.util.AnimatorBase.AnimatorBase | ( | final int | modeBits | ) |
Creates a new, empty Animator instance with given modeBits.
Passing MODE_EXPECT_AWT_RENDERING_THREAD is considered default. However, passing 0 is recommended if not using AWT in your application.
Definition at line 152 of file AnimatorBase.java.
| final synchronized void com.jogamp.opengl.util.AnimatorBase.add | ( | final GLAutoDrawable | drawable | ) |
Adds a drawable to this animator's list of rendering drawables.
This allows the animator thread to become animating, in case the first drawable is added and the animator is started.
| drawable | the drawable to be added |
| IllegalArgumentException | if drawable was already added to this animator |
Implements com.jogamp.opengl.GLAnimatorControl.
Definition at line 218 of file AnimatorBase.java.
|
protected |
Called every frame to cause redrawing of all of the GLAutoDrawables this Animator manages.
Subclasses should call this to get the most optimized painting behavior for the set of components this Animator manages, in particular when multiple lightweight widgets are continually being redrawn.
Definition at line 470 of file AnimatorBase.java.
|
protected |
| waitCondition | method will wait until TO is reached or waitCondition.eval() returns false. |
| pollPeriod | if 0, method will wait until TO is reached or being notified. if > 0, method will wait for the given pollPeriod in milliseconds. |
true if waitCondition.eval() returned false or if non-blocking. Otherwise returns false. Definition at line 594 of file AnimatorBase.java.
|
protected |
Should be called in case of an uncaught exception from within the animator thread to flush all animator.
The animator instance shall not be locked when calling this method!
Definition at line 574 of file AnimatorBase.java.
|
abstractprotected |
Reimplemented in com.jogamp.opengl.util.Animator, com.jogamp.opengl.util.FPSAnimator, and com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet.CustomAnimator.
| final synchronized Thread com.jogamp.opengl.util.AnimatorBase.getExclusiveContextThread | ( | ) |
Returns the exclusive context thread if 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.
Definition at line 425 of file AnimatorBase.java.
| final long com.jogamp.opengl.util.AnimatorBase.getFPSStartTime | ( | ) |
Returns the time of the first display call in milliseconds after enabling this feature via setUpdateFPSFrames(int, PrintStream).
This value is reset via resetFPSCounter().
Implements com.jogamp.opengl.FPSCounter.
Definition at line 491 of file AnimatorBase.java.
| final float com.jogamp.opengl.util.AnimatorBase.getLastFPS | ( | ) |
getUpdateFPSFrames() / getLastFPSPeriod()Implements com.jogamp.opengl.FPSCounter.
Definition at line 506 of file AnimatorBase.java.
| final long com.jogamp.opengl.util.AnimatorBase.getLastFPSPeriod | ( | ) |
Implements com.jogamp.opengl.FPSCounter.
Definition at line 501 of file AnimatorBase.java.
| final long com.jogamp.opengl.util.AnimatorBase.getLastFPSUpdateTime | ( | ) |
Returns the time of the last update interval in milliseconds, if this feature is enabled via setUpdateFPSFrames(int, PrintStream).
This value is reset via resetFPSCounter().
Implements com.jogamp.opengl.FPSCounter.
Definition at line 496 of file AnimatorBase.java.
| synchronized int com.jogamp.opengl.util.AnimatorBase.getModeBits | ( | ) |
Definition at line 214 of file AnimatorBase.java.
| final synchronized Thread com.jogamp.opengl.util.AnimatorBase.getThread | ( | ) |
Implements com.jogamp.opengl.GLAnimatorControl.
Definition at line 461 of file AnimatorBase.java.
|
staticprotected |
| final float com.jogamp.opengl.util.AnimatorBase.getTotalFPS | ( | ) |
getTotalFPSFrames() / getTotalFPSDuration()Implements com.jogamp.opengl.FPSCounter.
Definition at line 521 of file AnimatorBase.java.
| final long com.jogamp.opengl.util.AnimatorBase.getTotalFPSDuration | ( | ) |
getLastFPSUpdateTime() - getFPSStartTime()Implements com.jogamp.opengl.FPSCounter.
Definition at line 516 of file AnimatorBase.java.
| final int com.jogamp.opengl.util.AnimatorBase.getTotalFPSFrames | ( | ) |
getFPSStartTime() up to getLastFPSUpdateTime()Implements com.jogamp.opengl.FPSCounter.
Definition at line 511 of file AnimatorBase.java.
| final UncaughtExceptionHandler com.jogamp.opengl.util.AnimatorBase.getUncaughtExceptionHandler | ( | ) |
Returns the UncaughtExceptionHandler invoked when this animator abruptly stops due to an uncaught exception from one of its GLAutoDrawables.
Default is null.
Implements com.jogamp.opengl.GLAnimatorControl.
Definition at line 541 of file AnimatorBase.java.
| final int com.jogamp.opengl.util.AnimatorBase.getUpdateFPSFrames | ( | ) |
Implements com.jogamp.opengl.FPSCounter.
Definition at line 486 of file AnimatorBase.java.
|
protected |
Should be called in case of an uncaught exception from within the animator thread, throws given exception if no handler has been installed.
true if handled, otherwise false. In case of false, caller needs to propagate the exception. Definition at line 556 of file AnimatorBase.java.
|
protected |
Initializes implementation details post setup, invoked at add(GLAutoDrawable), start(), .
Operation is a NOP if force is false and this instance is already initialized.
| GLException | if Animator is isStarted() |
Definition at line 171 of file AnimatorBase.java.
| final synchronized boolean com.jogamp.opengl.util.AnimatorBase.isExclusiveContextEnabled | ( | ) |
Returns true, if the exclusive context thread is enabled, otherwise false.
Definition at line 407 of file AnimatorBase.java.
| synchronized boolean com.jogamp.opengl.util.AnimatorBase.isStarted | ( | ) |
Indicates whether this animator has been started.
Implements com.jogamp.opengl.GLAnimatorControl.
Reimplemented in com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet.CustomAnimator.
Definition at line 659 of file AnimatorBase.java.
| final synchronized void com.jogamp.opengl.util.AnimatorBase.remove | ( | final GLAutoDrawable | drawable | ) |
Removes a drawable from the animator's list of rendering drawables.
This 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.
| drawable | the drawable to be removed |
| IllegalArgumentException | if drawable was not added to this animator |
Implements com.jogamp.opengl.GLAnimatorControl.
Definition at line 250 of file AnimatorBase.java.
| final void com.jogamp.opengl.util.AnimatorBase.resetFPSCounter | ( | ) |
Reset all performance counter (startTime, currentTime, frame number)
Implements com.jogamp.opengl.FPSCounter.
Definition at line 481 of file AnimatorBase.java.
|
protected |
Should be called at start() and stop() from within the animator thread.
At stop() an additional display() call shall be issued to allow propagation of releasing the exclusive thread.
Definition at line 437 of file AnimatorBase.java.
| final boolean com.jogamp.opengl.util.AnimatorBase.setExclusiveContext | ( | final boolean | enable | ) |
Dedicate all GLAutoDrawable's context to this animator thread.
The given thread will be exclusive to all GLAutoDrawable's context while 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 |
Definition at line 345 of file AnimatorBase.java.
| final synchronized Thread com.jogamp.opengl.util.AnimatorBase.setExclusiveContext | ( | final Thread | t | ) |
Dedicate all GLAutoDrawable's context to the given exclusive context thread.
The given thread will be exclusive to all GLAutoDrawable's context while 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 |
Definition at line 313 of file AnimatorBase.java.
| final void com.jogamp.opengl.util.AnimatorBase.setIgnoreExceptions | ( | final boolean | ignoreExceptions | ) |
Sets a flag causing this Animator to ignore exceptions produced while redrawing the drawables.
By default this flag is set to false, causing any exception thrown to halt the Animator.
Definition at line 528 of file AnimatorBase.java.
| final synchronized void com.jogamp.opengl.util.AnimatorBase.setModeBits | ( | final boolean | enable, |
| final int | bitValues | ||
| ) | throws GLException |
Enables or disables the given bitValues in this Animators modeBits.
| enable | |
| bitValues |
| GLException | if Animator is isStarted() and MODE_EXPECT_AWT_RENDERING_THREAD about to change |
Definition at line 200 of file AnimatorBase.java.
| final void com.jogamp.opengl.util.AnimatorBase.setPrintExceptions | ( | final boolean | printExceptions | ) |
Sets a flag indicating that when exceptions are being ignored by this Animator (see setIgnoreExceptions), to print the exceptions' stack traces for diagnostic information.
Defaults to false.
Definition at line 536 of file AnimatorBase.java.
| final void com.jogamp.opengl.util.AnimatorBase.setUncaughtExceptionHandler | ( | final UncaughtExceptionHandler | handler | ) |
Set the handler invoked when this animator abruptly stops due to an uncaught exception from one of its GLAutoDrawables.
| handler | the UncaughtExceptionHandler to use as this animator's uncaught exception handler. Pass null to unset the handler. |
Implements com.jogamp.opengl.GLAnimatorControl.
Definition at line 546 of file AnimatorBase.java.
| final void com.jogamp.opengl.util.AnimatorBase.setUpdateFPSFrames | ( | final int | frames, |
| final PrintStream | out | ||
| ) |
| frames | Update interval in frames. At every rendered frames interval the currentTime and fps values are updated. If the frames interval is <= 0, no update will be issued, ie the FPSCounter feature is turned off. You may choose DEFAULT_FRAMES_PER_INTERVAL. |
| out | optional print stream where the fps values gets printed if not null at every frames interval |
Implements com.jogamp.opengl.FPSCounter.
Definition at line 476 of file AnimatorBase.java.
| String com.jogamp.opengl.util.AnimatorBase.toString | ( | ) |
Definition at line 666 of file AnimatorBase.java.
|
protected |
|
protected |
Definition at line 104 of file AnimatorBase.java.
|
protected |
Definition at line 100 of file AnimatorBase.java.
|
staticprotected |
Definition at line 56 of file AnimatorBase.java.
|
protected |
Definition at line 102 of file AnimatorBase.java.
|
protected |
Definition at line 103 of file AnimatorBase.java.
|
protected |
Definition at line 107 of file AnimatorBase.java.
|
protected |
Definition at line 110 of file AnimatorBase.java.
|
protected |
Definition at line 105 of file AnimatorBase.java.
|
protected |
Definition at line 99 of file AnimatorBase.java.
|
static |
If present in modeBits field and AWT is available, implementation is aware of the AWT EDT, otherwise not.
This is the default.
Definition at line 72 of file AnimatorBase.java.
|
protected |
Definition at line 98 of file AnimatorBase.java.
|
staticprotected |
Definition at line 61 of file AnimatorBase.java.
|
protected |
Definition at line 106 of file AnimatorBase.java.
|
staticprotected |
A 1s timeout while waiting for a native action response, limiting finishLifecycleAction(Condition, long).
Definition at line 59 of file AnimatorBase.java.
|
protected |
Definition at line 109 of file AnimatorBase.java.
|
protected |
Definition at line 108 of file AnimatorBase.java.