JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.opengl.util.GLDrawableUtil Class Reference

Providing utility functions dealing w/ GLDrawables, GLAutoDrawable and their GLEventListener. More...

Collaboration diagram for com.jogamp.opengl.util.GLDrawableUtil:

Classes

class  ReshapeGLEventListener
 GLRunnable to issue GLEventListener#reshape(GLAutoDrawable, int, int, int, int), returning true on GLRunnable#run(GLAutoDrawable). More...
 

Static Public Member Functions

static final boolean isAnimatorStartedOnOtherThread (final GLAnimatorControl animatorCtrl)
 
static final boolean isAnimatorStarted (final GLAnimatorControl animatorCtrl)
 
static final boolean isAnimatorAnimatingOnOtherThread (final GLAnimatorControl animatorCtrl)
 
static final boolean isAnimatorAnimating (final GLAnimatorControl animatorCtrl)
 
static final void moveGLEventListener (final GLAutoDrawable src, final GLAutoDrawable dest, final GLEventListener listener, final boolean preserveInitState)
 Moves the designated GLEventListener from GLAutoDrawable src to dest. More...
 
static final void moveAllGLEventListener (final GLAutoDrawable src, final GLAutoDrawable dest, final boolean preserveInitState)
 Moves all GLEventListener from GLAutoDrawable src to dest. More...
 
static boolean isSwapGLContextSafe (final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesImmutable chosenCapsA, final GLCapabilitiesImmutable chosenCapsB)
 Return a heuristic value whether switching the GLContext is safe between GLAutoDrawables, i.e. More...
 
static final void swapGLContextAndAllGLEventListener (final GLAutoDrawable a, final GLAutoDrawable b)
 Swaps the GLContext and all GLEventListener between GLAutoDrawable a and b, while preserving it's initialized state, resets the GL-Viewport and issuing reshape(..). More...
 
static final void swapGLContext (final GLAutoDrawable a, final GLAutoDrawable b)
 Swaps the GLContext of given GLAutoDrawable and disposes each GLEventListener w/o removing it. More...
 
static final boolean swapBuffersBeforeRead (final GLCapabilitiesImmutable chosenCaps)
 Determines whether the chosen GLCapabilitiesImmutable requires a swap-buffers before reading pixels. More...
 

Static Protected Attributes

static final boolean DEBUG = Debug.debug("GLDrawable")
 

Detailed Description

Providing utility functions dealing w/ GLDrawables, GLAutoDrawable and their GLEventListener.

Definition at line 51 of file GLDrawableUtil.java.

Member Function Documentation

◆ isAnimatorAnimating()

static final boolean com.jogamp.opengl.util.GLDrawableUtil.isAnimatorAnimating ( final GLAnimatorControl  animatorCtrl)
static

Definition at line 66 of file GLDrawableUtil.java.

Here is the call graph for this function:

◆ isAnimatorAnimatingOnOtherThread()

static final boolean com.jogamp.opengl.util.GLDrawableUtil.isAnimatorAnimatingOnOtherThread ( final GLAnimatorControl  animatorCtrl)
static

Definition at line 62 of file GLDrawableUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isAnimatorStarted()

static final boolean com.jogamp.opengl.util.GLDrawableUtil.isAnimatorStarted ( final GLAnimatorControl  animatorCtrl)
static

Definition at line 58 of file GLDrawableUtil.java.

Here is the call graph for this function:

◆ isAnimatorStartedOnOtherThread()

static final boolean com.jogamp.opengl.util.GLDrawableUtil.isAnimatorStartedOnOtherThread ( final GLAnimatorControl  animatorCtrl)
static

Definition at line 54 of file GLDrawableUtil.java.

Here is the call graph for this function:

◆ isSwapGLContextSafe()

static boolean com.jogamp.opengl.util.GLDrawableUtil.isSwapGLContextSafe ( final GLCapabilitiesImmutable  requestedCaps,
final GLCapabilitiesImmutable  chosenCapsA,
final GLCapabilitiesImmutable  chosenCapsB 
)
static

Return a heuristic value whether switching the GLContext is safe between GLAutoDrawables, i.e.

via swapGLContext(GLAutoDrawable, GLAutoDrawable) or swapGLContextAndAllGLEventListener(GLAutoDrawable, GLAutoDrawable).

Method currently returns false if:

Otherwise method returns true

[1] See Bug 830: swapGLContextAndAllGLEventListener and onscreen MSAA w/ NV/GLX
    On NVidia GPUs w/ it's proprietary driver context swapping does not work if MSAA is involved
    and when swapping on- to offscreen.
[2] On AMD GPUs w/ it's proprietary driver, requesting an accumulator buffer leads to receive an accumulator buffer configuration,
    for which context swapping does not work when swapping on- to offscreen and vice-versa, i.e. cannot make context current.
    With AMD and Mesa drivers we only receive an accumulator buffer if requested,
    where on NVidia drivers all configurations contain the accumulator buffer.
    On both drivers, NVidia and Mesa, context swapping with accumulator buffer works.
Parameters
requestedCapsrequested GLCapabilitiesImmutable which are intended for usage by both GLAutoDrawables A and B
chosenCapsAchosen GLCapabilitiesImmutable of GLAutoDrawable A, which GLContext is intended to be swapped
chosenCapsBchosen GLCapabilitiesImmutable of GLAutoDrawable B, which GLContext is intended to be swapped
See also
swapGLContext(GLAutoDrawable, GLAutoDrawable)
swapGLContextAndAllGLEventListener(GLAutoDrawable, GLAutoDrawable)

Definition at line 185 of file GLDrawableUtil.java.

Here is the call graph for this function:

◆ moveAllGLEventListener()

static final void com.jogamp.opengl.util.GLDrawableUtil.moveAllGLEventListener ( final GLAutoDrawable  src,
final GLAutoDrawable  dest,
final boolean  preserveInitState 
)
static

Moves all GLEventListener from GLAutoDrawable src to dest.

If preserveInitState is true, it's initialized state is preserved and reshape(..) issued w/ the next GLAutoDrawable#display() call.

Note that it is only legal to pass preserveInitState := true, if the GLContext of both src and dest are shared, or has itself moved from src to dest.

Also note that the caller is encouraged to pause an attached GLAnimatorControl.

Parameters
src
dest
listener
preserveInitState

Definition at line 145 of file GLDrawableUtil.java.

Here is the call graph for this function:

◆ moveGLEventListener()

static final void com.jogamp.opengl.util.GLDrawableUtil.moveGLEventListener ( final GLAutoDrawable  src,
final GLAutoDrawable  dest,
final GLEventListener  listener,
final boolean  preserveInitState 
)
static

Moves the designated GLEventListener from GLAutoDrawable src to dest.

If preserveInitState is true, it's initialized state is preserved and reshape(..) issued w/ the next GLAutoDrawable#display() call.

Note that it is only legal to pass preserveInitState := true, if the GLContext of both src and dest are shared, or has itself moved from src to dest.

Also note that the caller is encouraged to pause an attached GLAnimatorControl.

Parameters
src
dest
listener
preserveInitState

Definition at line 114 of file GLDrawableUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swapBuffersBeforeRead()

static final boolean com.jogamp.opengl.util.GLDrawableUtil.swapBuffersBeforeRead ( final GLCapabilitiesImmutable  chosenCaps)
static

Determines whether the chosen GLCapabilitiesImmutable requires a swap-buffers before reading pixels.

Usually one uses the default-read-buffer in which case swap-buffers shall happen after calling reading pixels, the default.

However, multisampling offscreen com.jogamp.opengl.GLFBODrawables utilize swap-buffers to downsample the multisamples into the readable sampling sink. In this case, we require swap-buffers before reading pixels.

Returns
chosenCaps.isFBO() && chosenCaps.getSampleBuffers()

Definition at line 343 of file GLDrawableUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swapGLContext()

static final void com.jogamp.opengl.util.GLDrawableUtil.swapGLContext ( final GLAutoDrawable  a,
final GLAutoDrawable  b 
)
static

Swaps the GLContext of given GLAutoDrawable and disposes each GLEventListener w/o removing it.

The GL-Viewport is reset and reshape(..) issued implicit.

If an GLAnimatorControl is being attached to GLAutoDrawable src or dest and the current thread is different than the animator's thread, it is paused during the operation.

During operation, both auto-drawable's upstream-locks and surfaces are locked, hence atomicity of operation is guaranteed, see GLAutoDrawable Locking.

Because of above mentioned locking, if this method is not performed on a OpenGL capable thread of both GLAutoDrawables, it must be invoked on such an OpenGL capable thread, e.g. via Threading#invokeOnOpenGLThread(boolean, Runnable).

Parameters
a
b
See also
isSwapGLContextSafe(GLCapabilitiesImmutable, GLCapabilitiesImmutable, GLCapabilitiesImmutable)

Definition at line 271 of file GLDrawableUtil.java.

Here is the call graph for this function:

◆ swapGLContextAndAllGLEventListener()

static final void com.jogamp.opengl.util.GLDrawableUtil.swapGLContextAndAllGLEventListener ( final GLAutoDrawable  a,
final GLAutoDrawable  b 
)
static

Swaps the GLContext and all GLEventListener between GLAutoDrawable a and b, while preserving it's initialized state, resets the GL-Viewport and issuing reshape(..).

The GLAutoDrawable to GLAnimatorControl association is also swapped.

If an GLAnimatorControl is being attached to GLAutoDrawable a or b and the current thread is different than the animator's thread, it is paused during the operation.

During operation, both auto-drawable's upstream-locks and surfaces are locked, hence atomicity of operation is guaranteed, see GLAutoDrawable Locking.

Because of above mentioned locking, if this method is not performed on a OpenGL capable thread of both GLAutoDrawables, it must be invoked on such an OpenGL capable thread, e.g. via Threading#invokeOnOpenGLThread(boolean, Runnable).

Exceptions
GLExceptionif the AbstractGraphicsDevice are incompatible w/ each other.
See also
isSwapGLContextSafe(GLCapabilitiesImmutable, GLCapabilitiesImmutable, GLCapabilitiesImmutable)

Definition at line 229 of file GLDrawableUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ DEBUG

final boolean com.jogamp.opengl.util.GLDrawableUtil.DEBUG = Debug.debug("GLDrawable")
staticprotected

Definition at line 52 of file GLDrawableUtil.java.


The documentation for this class was generated from the following file: