Top Description Fields Constructors Methods
com.jogamp.opengl

public Class GLEventListenerState

extends Object
Class Inheritance
Imports
java.util.ArrayList, .List, com.jogamp.nativewindow.AbstractGraphicsConfiguration, .AbstractGraphicsDevice, .DefaultGraphicsDevice, .NativeSurface, .ProxySurface, .MutableGraphicsConfiguration, com.jogamp.opengl.GLAnimatorControl, .GLAutoDrawable, .GLCapabilitiesImmutable, .GLContext, .GLEventListener, .GLException, .GLRunnable, jogamp.opengl.Debug, com.jogamp.common.util.locks.RecursiveLock, com.jogamp.opengl.util.GLDrawableUtil

GLEventListenerState is holding GLAutoDrawable components crucial to relocating all its GLEventListener w/ their operating GLContext, etc. The components are:

A GLEventListenerState instance can be created while components are moved from a GLAutoDrawable to the new instance, which gains ownership of the moved components.

A GLEventListenerState instance's components can be moved to a GLAutoDrawable, while loosing ownership of the moved components.

Field Summary

Modifier and TypeField and Description
public final GLAnimatorControl
public final boolean
public final GLCapabilitiesImmutable
public final GLContext
private static final boolean
public final AbstractGraphicsDevice
private static final GLRunnable
public final GLEventListener[]
public final boolean[]
private volatile NativeSurface
private volatile boolean
public final boolean
private static final GLRunnable
private final Runnable
public final AbstractGraphicsDevice
private volatile RecursiveLock

Constructor Summary

AccessConstructor and Description
private
GLEventListenerState(final AbstractGraphicsDevice upstreamDevice, final boolean proxyOwnsUpstreamDevice, final AbstractGraphicsDevice device, final GLCapabilitiesImmutable caps, final RecursiveLock upstreamLock, final NativeSurface lockedSurface, final GLContext context, final int count, final GLAnimatorControl anim, final boolean animStarted)

Method Summary

Modifier and TypeMethod and Description
private static AbstractGraphicsDevice
public void
destroy()

Last resort to destroy and loose ownership

public Runnable
public final boolean
isOwner()

Returns true, if this instance is the current owner of the components, otherwise false.

public final int
public static GLEventListenerState

Returns:

new GLEventListenerState instance owning moved components.
moveFrom
(final GLAutoDrawable
GLAutoDrawable source to move components from
src
)

Moves all GLEventListenerState components from the given GLAutoDrawable to a newly created instance.

public static GLEventListenerState

Returns:

new GLEventListenerState instance owning moved components.
moveFrom
(final GLAutoDrawable
GLAutoDrawable source to move components from
src
,
final boolean
keep upstream-lock and surface locked, see above
keepLocked
)

Moves all GLEventListenerState components from the given GLAutoDrawable to a newly created instance.

public final void
moveTo(final GLAutoDrawable
GLAutoDrawable destination to move GLEventListenerState components to
dest
)

Moves all GLEventListenerState components to the given GLAutoDrawable from this instance, while loosing ownership.

public final void
moveTo(final GLAutoDrawable
GLAutoDrawable destination to move GLEventListenerState components to
dest
,
final Runnable
optional unlock operation for dest, see moveFrom(GLAutoDrawable, boolean).
destUnlockOperation
)

Moves all GLEventListenerState components to the given GLAutoDrawable from this instance, while loosing ownership.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

animback to summary
public final GLAnimatorControl anim
animStartedback to summary
public final boolean animStarted
capsback to summary
public final GLCapabilitiesImmutable caps
contextback to summary
public final GLContext context
DEBUGback to summary
private static final boolean DEBUG
deviceback to summary
public final AbstractGraphicsDevice device
glFinishback to summary
private static final GLRunnable glFinish
listenersback to summary
public final GLEventListener[] listeners
listenersInitback to summary
public final boolean[] listenersInit
lockedSurfaceback to summary
private volatile NativeSurface lockedSurface
ownerback to summary
private volatile boolean owner
proxyOwnsUpstreamDeviceback to summary
public final boolean proxyOwnsUpstreamDevice
setViewportback to summary
private static final GLRunnable setViewport
unlockOpback to summary
private final Runnable unlockOp
upstreamDeviceback to summary
public final AbstractGraphicsDevice upstreamDevice
upstreamLockback to summary
private volatile RecursiveLock upstreamLock

Constructor Detail

GLEventListenerStateback to summary
private GLEventListenerState(final AbstractGraphicsDevice upstreamDevice, final boolean proxyOwnsUpstreamDevice, final AbstractGraphicsDevice device, final GLCapabilitiesImmutable caps, final RecursiveLock upstreamLock, final NativeSurface lockedSurface, final GLContext context, final int count, final GLAnimatorControl anim, final boolean animStarted)

Method Detail

cloneDeviceback to summary
private static AbstractGraphicsDevice cloneDevice(final AbstractGraphicsDevice aDevice)
destroyback to summary
public void destroy()

Last resort to destroy and loose ownership

getUnlockSurfaceOpback to summary
public Runnable getUnlockSurfaceOp()

Returns a Runnable unlocking an eventually locked NativeSurface, see moveFrom(GLAutoDrawable, boolean) and moveTo(GLAutoDrawable, Runnable).

isOwnerback to summary
public final boolean isOwner()

Returns true, if this instance is the current owner of the components, otherwise false.

Ownership is lost if moveTo(GLAutoDrawable) is being called successfully and all components are transferred to the new GLAutoDrawable.

listenerCountback to summary
public final int listenerCount()
moveFromback to summary
public static GLEventListenerState moveFrom(final GLAutoDrawable src)

Moves all GLEventListenerState components from the given GLAutoDrawable to a newly created instance.

Note that all components are removed from the GLAutoDrawable, i.e. the GLContext, all GLEventListener.

If the GLAutoDrawable was added to a GLAnimatorControl, it is removed and the GLAnimatorControl added to the GLEventListenerState.

The returned GLEventListenerState instance is the owner of the components.

Locking is performed on the auto-drawable's upstream-lock and surface. See GLAutoDrawable Locking.

Parameters
src:GLAutoDrawable

GLAutoDrawable source to move components from

Returns:GLEventListenerState

new GLEventListenerState instance owning moved components.

See Also
moveTo(GLAutoDrawable)
moveFromback to summary
public static GLEventListenerState moveFrom(final GLAutoDrawable src, final boolean keepLocked)

Moves all GLEventListenerState components from the given GLAutoDrawable to a newly created instance.

Note that all components are removed from the GLAutoDrawable, i.e. the GLContext, all GLEventListener.

If the GLAutoDrawable was added to a GLAnimatorControl, it is removed and the GLAnimatorControl added to the GLEventListenerState.

The returned GLEventListenerState instance is the owner of the components.

Locking is performed on the auto-drawable's upstream-lock and surface, which is not released if keepLocked is true. See GLAutoDrawable Locking.

keepLocked may be utilized if swapping a context between drawables and to ensure atomicity of operation. Here, the getUnlockSurfaceOp() shall be passed to moveTo(GLAutoDrawable, Runnable). See GLDrawableUtil#swapGLContextAndAllGLEventListener(GLAutoDrawable, GLAutoDrawable).

Parameters
src:GLAutoDrawable

GLAutoDrawable source to move components from

keepLocked:boolean

keep upstream-lock and surface locked, see above

Returns:GLEventListenerState

new GLEventListenerState instance owning moved components.

See Also
moveTo(GLAutoDrawable, Runnable)
moveToback to summary
public final void moveTo(final GLAutoDrawable dest) throws GLException

Moves all GLEventListenerState components to the given GLAutoDrawable from this instance, while loosing ownership.

If the previous GLAutoDrawable was removed from a GLAnimatorControl by previous moveFrom(GLAutoDrawable), the given GLAutoDrawable is added to the cached GLAnimatorControl. This operation is skipped, if the given GLAutoDrawable is already added to a GLAnimatorControl instance.

Locking is performed on the auto-drawable's upstream-lock and surface. See GLAutoDrawable Locking.

Note

After this operation, the GLEventListenerState reference should be released.

Parameters
dest:GLAutoDrawable

GLAutoDrawable destination to move GLEventListenerState components to

Exceptions
GLException:
  • if a realized surface could not be locked.
  • if this preserved AbstractGraphicsDevice is incompatible w/ the given destination one.
See Also
moveFrom(GLAutoDrawable), isOwner()
moveToback to summary
public final void moveTo(final GLAutoDrawable dest, final Runnable destUnlockOperation) throws GLException

Moves all GLEventListenerState components to the given GLAutoDrawable from this instance, while loosing ownership.

If the previous GLAutoDrawable was removed from a GLAnimatorControl by previous moveFrom(GLAutoDrawable, boolean), the given GLAutoDrawable is added to the cached GLAnimatorControl. This operation is skipped, if the given GLAutoDrawable is already added to a GLAnimatorControl instance.

Locking is performed on the auto-drawable's upstream-lock and surface. See GLAutoDrawable Locking.

If the GLAutoDrawable dest has been kept locked by moveFrom(GLAutoDrawable, boolean), it's getUnlockSurfaceOp() shall be passed here to destUnlockOperation to be unlocked.

Note

After this operation, the GLEventListenerState reference should be released.

Parameters
dest:GLAutoDrawable

GLAutoDrawable destination to move GLEventListenerState components to

destUnlockOperation:Runnable

optional unlock operation for dest, see moveFrom(GLAutoDrawable, boolean).

Exceptions
GLException:
  • if a realized surface could not be locked.
  • if this preserved AbstractGraphicsDevice is incompatible w/ the given destination one.
See Also
moveFrom(GLAutoDrawable, boolean), isOwner()