Top Description Fields Constructors Methods
jogamp.opengl

public abstract Class GLAutoDrawableBase

extends Object
implements GLAutoDrawable, GLStateKeeper, FPSCounter, GLSharedContextSetter
Class Inheritance
All Implemented Interfaces
com.jogamp.opengl.GLSharedContextSetter, com.jogamp.opengl.GLAutoDrawable, com.jogamp.opengl.GLDrawable, com.jogamp.nativewindow.NativeSurfaceHolder, com.jogamp.opengl.FPSCounter, com.jogamp.opengl.GLStateKeeper
Known Direct Subclasses
com.jogamp.newt.opengl.GLWindow, com.jogamp.opengl.GLAutoDrawableDelegate
Imports
java.io.PrintStream, java.util.List, com.jogamp.nativewindow.AbstractGraphicsDevice, .NativeSurface, .NativeWindowException, .WindowClosingProtocol, .WindowClosingProtocol.WindowClosingMode, com.jogamp.opengl.FPSCounter, .GL, .GLAnimatorControl, .GLAutoDrawable, .GLCapabilitiesImmutable, .GLContext, .GLDrawable, .GLEventListener, .GLException, .GLOffscreenAutoDrawable, .GLProfile, .GLRunnable, .GLSharedContextSetter, .GLAutoDrawableDelegate, .GLEventListenerState, .GLStateKeeper, com.jogamp.common.ExceptionUtils, com.jogamp.common.util.RunnableTask, com.jogamp.common.util.locks.RecursiveLock

Abstract common code for GLAutoDrawable implementations utilizing multithreading, i.e. isThreadGLCapable() always returns true.
See Also
GLAutoDrawable, GLAutoDrawable#getThreadingMode(), GLAutoDrawableDelegate, GLOffscreenAutoDrawable, GLOffscreenAutoDrawableImpl, GLPBufferImpl, com.jogamp.newt.opengl.GLWindow

Field Summary

Modifier and TypeField and Description
protected int
protected volatile GLContextImpl
public static final boolean
protected final Runnable
protected final Runnable
protected volatile GLDrawableImpl
protected final FPSCounterImpl
protected GLEventListenerState
protected GLStateKeeper.Listener
protected final GLDrawableHelper
protected final boolean
protected boolean
protected volatile boolean
protected volatile boolean

Constructor Summary

AccessConstructor and Description
public
GLAutoDrawableBase(final GLDrawableImpl
upstream GLDrawableImpl instance, may be null for lazy initialization
drawable
,
final GLContextImpl
upstream GLContextImpl instance, may not have been made current (created) yet, may not be associated w/ drawable yet, may be null for lazy initialization at 1st display().
context
,
final boolean
pass true if AbstractGraphicsDevice#close() shall be issued, otherwise pass false. Closing the device is required in case the drawable is created w/ it's own new instance, e.g. offscreen drawables, and no further lifecycle handling is applied.
ownsDevice
)

The GLContext can be assigned later manually via setContext(ctx) or it will be created lazily at the 1st display() method call.

Method Summary

Modifier and TypeMethod and Description
public final void
addGLEventListener(final GLEventListener
The GLEventListener object to be inserted
listener
)

Implements com.jogamp.opengl.GLAutoDrawable.addGLEventListener.

Adds the given listener to the end of this drawable queue.
public final void
addGLEventListener(final int
Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().
index
,
final GLEventListener
The GLEventListener object to be inserted
listener
)

Implements com.jogamp.opengl.GLAutoDrawable.addGLEventListener.

Adds the given listener at the given index of this drawable queue.
public boolean
areAllGLEventListenerInitialized()

Implements com.jogamp.opengl.GLAutoDrawable.areAllGLEventListenerInitialized.

Returns true if all added GLEventListener are initialized, otherwise false.
public final GLEventListenerState
clearPreservedGLState()

Implements com.jogamp.opengl.GLStateKeeper.clearPreservedGLState.

Clears the preserved GLEventListenerState from this GLStateKeeper, without destroying it.
public final GLContext
createContext(final GLContext shareWith)

Implements com.jogamp.opengl.GLAutoDrawable.createContext.

Creates a new context for drawing to this drawable that will optionally share buffer objects, textures and other server-side OpenGL objects with the specified GLContext.
protected final void
defaultDestroy()

Calls destroyImplInLock() while claiming the lock.

protected final void
protected final GLEventListener
defaultDisposeGLEventListener(final GLEventListener listener, final boolean remove)

public final void
protected final void
defaultWindowDestroyNotifyOp()

Default implementation to handle destroy notifications from the windowing system.

protected final void
defaultWindowRepaintOp()

Default implementation to handle repaint events from the windowing system

protected final void
defaultWindowResizedOp(final int
  • new width in pixel units
  • new height in pixel units
newWidth
,
final int newHeight)

Handling resize events from the windowing system.

protected final void
destroyAvoidAwareOfLocking()

Calls destroy() directly if the following requirements are met:

  • An GLAnimatorControl is bound (see getAnimator()) and running on another thread. Here we pause the animation while issuing the destruction.
  • Surface is not locked by another thread (considered anonymous).
protected void
destroyImplInLock()

Default implementation to destroys the drawable and context of this GLAutoDrawable:

  • issues the GLEventListener dispose call, if drawable and context are valid
  • destroys the GLContext, if valid
  • destroys the GLDrawable, if valid
public GLEventListener
disposeGLEventListener(final GLEventListener
The GLEventListener object to be disposed and removed if remove is true
listener
,
final boolean
pass true to have the listener removed from this drawable queue, otherwise pass false
remove
)

Implements com.jogamp.opengl.GLAutoDrawable.disposeGLEventListener.

Disposes the given listener via dispose(..) if it has been initialized and added to this queue.
public void
flushGLRunnables()

Implements com.jogamp.opengl.GLAutoDrawable.flushGLRunnables.

Flushes all enqueued GLRunnable of this GLAutoDrawable including notifying waiting executor.
public final GLAnimatorControl
public final boolean
getAutoSwapBufferMode()

Implements com.jogamp.opengl.GLAutoDrawable.getAutoSwapBufferMode.

Indicates whether automatic buffer swapping is enabled for this drawable.
public final GLCapabilitiesImmutable
getChosenGLCapabilities()

Implements com.jogamp.opengl.GLDrawable.getChosenGLCapabilities.

Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / visual / GLProfile) for this drawable.
public final GLContext
getContext()

Implements com.jogamp.opengl.GLAutoDrawable.getContext.

Returns the context associated with this drawable.
public final int
public final GLDrawable
getDelegatedDrawable()

Implements com.jogamp.opengl.GLAutoDrawable.getDelegatedDrawable.

If the implementation uses delegation, return the delegated GLDrawable instance, otherwise return this instance.
public final Thread
public final long
getFPSStartTime()

Implements com.jogamp.opengl.FPSCounter.getFPSStartTime.

Returns the time of the first display call in milliseconds after enabling this feature via setUpdateFPSFrames(int, PrintStream).
public final GL
getGL()

Implements com.jogamp.opengl.GLAutoDrawable.getGL.

Returns the GL pipeline object this GLAutoDrawable uses.
public GLEventListener
getGLEventListener(final int
Position of the listener to be returned. Should be within (0 <= index && index < size()). An index value of -1 is interpreted as last listener, size()-1.
index
)

Implements com.jogamp.opengl.GLAutoDrawable.getGLEventListener.

Returns the GLEventListener at the given index of this drawable queue.
public int
public boolean
getGLEventListenerInitState(final GLEventListener
the GLEventListener object to query it's initialized state.
listener
)

Implements com.jogamp.opengl.GLAutoDrawable.getGLEventListenerInitState.

Retrieves whether the given listener is initialized or not.
public final GLProfile
getGLProfile()

Implements com.jogamp.opengl.GLDrawable.getGLProfile.

Fetches the GLProfile for this drawable.
public final long
getHandle()

Implements com.jogamp.opengl.GLDrawable.getHandle.

Returns the GL drawable handle, guaranteed to be valid after realization and while it's surface is being locked.
public final float
public final long
public final long
getLastFPSUpdateTime()

Implements com.jogamp.opengl.FPSCounter.getLastFPSUpdateTime.

Returns the time of the last update interval in milliseconds, if this feature is enabled via setUpdateFPSFrames(int, PrintStream).
public final NativeSurface
public final GLEventListenerState
getPreservedGLState()

Implements com.jogamp.opengl.GLStateKeeper.getPreservedGLState.

Returns the preserved GLEventListenerState if preservation was performed, otherwise null.
public final GLCapabilitiesImmutable
getRequestedGLCapabilities()

Implements com.jogamp.opengl.GLDrawable.getRequestedGLCapabilities.

Fetches the GLCapabilitiesImmutable corresponding to the user requested OpenGL capabilities (pixel format / visual / GLProfile) for this drawable.
public int
getSurfaceHeight()

Implements com.jogamp.opengl.GLDrawable.getSurfaceHeight.

Returns the height of this GLDrawable's surface client area in pixel units.
public int
getSurfaceWidth()

Implements com.jogamp.opengl.GLDrawable.getSurfaceWidth.

Returns the width of this GLDrawable's surface client area in pixel units.
protected static String
public final float
public final long
public final int
public final int
public final boolean
invoke(final boolean
if true block until execution of glRunnable is finished, otherwise return immediately w/o waiting
wait
,
final GLRunnable
the GLRunnable to execute within display()
glRunnable
)

Implements com.jogamp.opengl.GLAutoDrawable.invoke.

Enqueues a one-shot GLRunnable, which will be executed within the next display() call after all registered GLEventListeners display(GLAutoDrawable) methods have been called.
public boolean
invoke(final boolean
if true block until execution of the last glRunnable is finished, otherwise return immediately w/o waiting
wait
,
final List<GLRunnable>
the GLRunnables to execute within display()
glRunnables
)

Implements com.jogamp.opengl.GLAutoDrawable.invoke.

Extends invoke(boolean, GLRunnable) functionality allowing to inject a list of GLRunnables.
public final void
invokeOnCurrentThread(final Runnable
the Runnable to execute on the new thread. The runnable must exit, i.e. not loop forever.
runnable
)

Invokes given runnable on current thread outside of a probable claimed exclusive thread, i.e. releases the exclusive thread, executes the runnable and reclaims it.

public final RunnableTask

Returns:

RunnableTask instance with execution details
invokeOnNewThread
(final ThreadGroup
the ThreadGroup for the new thread, maybe null
tg
,
final boolean
if true, waits until runnable execution is completed, otherwise returns immediately.
waitUntilDone
,
final Runnable
the Runnable to execute on the new thread. The runnable must exit, i.e. not loop forever.
runnable
)

Invokes given runnable on current thread outside of a probable claimed exclusive thread, i.e. releases the exclusive thread, executes the runnable and reclaims it.

public boolean
isGLOriented()

Implements com.jogamp.opengl.GLDrawable.isGLOriented.

Returns true if the drawable is rendered in OpenGL's coordinate system, origin at bottom left.
public boolean
public final boolean
isRealized()

Implements com.jogamp.opengl.GLDrawable.isRealized.

Returns true if this drawable is realized, otherwise true.
public final boolean
isThreadGLCapable()

Implements com.jogamp.opengl.GLAutoDrawable.isThreadGLCapable.

Indicates whether the current thread is capable of performing OpenGL-related work.
protected final boolean

Returns:

true if the GLEventListenerState is preserved successfully from this GLAutoDrawable, otherwise false.
preserveGLEventListenerState
()

Preserves the GLEventListenerState from this GLAutoDrawable.

public final boolean
public final GLEventListener
removeGLEventListener(final GLEventListener
The GLEventListener object to be removed
listener
)

Implements com.jogamp.opengl.GLAutoDrawable.removeGLEventListener.

Removes the given listener from this drawable queue.
public final void
resetFPSCounter()

Implements com.jogamp.opengl.FPSCounter.resetFPSCounter.

Reset all performance counter (startTime, currentTime, frame number)
protected final boolean

Returns:

true if the GLEventListenerState was previously preserved and is moved successfully to this GLAutoDrawable, otherwise false.
restoreGLEventListenerState
()

Restores a previously preserved GLEventListenerState to this GLAutoDrawable.

public final void
setAnimator(final GLAnimatorControl
null reference indicates no animator is using this GLAutoDrawable,
a valid reference indicates an animator is using this GLAutoDrawable.
animatorControl
)

Implements com.jogamp.opengl.GLAutoDrawable.setAnimator.

Registers the usage of an animator, an com.jogamp.opengl.GLAnimatorControl implementation.
public final void
setAutoSwapBufferMode(final boolean enable)

Implements com.jogamp.opengl.GLAutoDrawable.setAutoSwapBufferMode.

Enables or disables automatic buffer swapping for this drawable.
public final GLContext
setContext(final GLContext
the new context, maybe null for dis-association.
newCtx
,
final boolean
if true, destroy the previous context if exists
destroyPrevCtx
)

Implements com.jogamp.opengl.GLAutoDrawable.setContext.

Associate the new context, newtCtx, to this auto-drawable.
public final void
setContextCreationFlags(final int
Additional context creation flags.
flags
)

Implements com.jogamp.opengl.GLAutoDrawable.setContextCreationFlags.

public final Thread
setExclusiveContextThread(final Thread
the exclusive thread to claim the context, or null for default operation.
t
)

Implements com.jogamp.opengl.GLAutoDrawable.setExclusiveContextThread.

Dedicates this instance's GLContext to the given thread.
public final GL
setGL(final GL gl)

Implements com.jogamp.opengl.GLAutoDrawable.setGL.

Sets the GL pipeline object this GLAutoDrawable uses.
public void
setGLEventListenerInitState(final GLEventListener
the GLEventListener object to perform a state change.
listener
,
final boolean
if true, mark the listener initialized, otherwise uninitialized.
initialized
)

Implements com.jogamp.opengl.GLAutoDrawable.setGLEventListenerInitState.

Sets the given listener's initialized state.
public final GLStateKeeper.Listener
public final void
setRealized(final boolean realized)

Implements com.jogamp.opengl.GLDrawable.setRealized.

Indicates to GLDrawable implementations whether the underlying surface has been created and can be drawn into.
public final void
setSharedAutoDrawable(final GLAutoDrawable
The GLAutoDrawable, which OpenGL context shall be shared by this GLAutoDrawable's GLContext.
sharedAutoDrawable
)

Implements com.jogamp.opengl.GLSharedContextSetter.setSharedAutoDrawable.

Specifies an GLAutoDrawable, which OpenGL context shall be shared by this GLAutoDrawable's GLContext.
public final void
setSharedContext(final GLContext
The OpenGL context to be shared by this GLAutoDrawable's GLContext.
sharedContext
)

Implements com.jogamp.opengl.GLSharedContextSetter.setSharedContext.

Specifies an OpenGL context, which shall be shared by this GLAutoDrawable's GLContext.
public final void
setUpdateFPSFrames(final int
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.
frames
,
final PrintStream
optional print stream where the fps values gets printed if not null at every frames interval
out
)

Implements com.jogamp.opengl.FPSCounter.setUpdateFPSFrames.

public String
toString()

Overrides java.lang.Object.toString.

Implements com.jogamp.opengl.GLDrawable.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait