JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3 Class Reference

Sharing the VBO of 3 GearsES2 instances, each in their own SWT GLCanvas. More...

Inheritance diagram for com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3:
Collaboration diagram for com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3:

Public Member Functions

void init ()
 
void release ()
 
void test01SyncedOneAnimator () throws InterruptedException
 
void test02AsyncEachAnimator () throws InterruptedException
 
- Public Member Functions inherited from com.jogamp.opengl.test.junit.util.UITestCase
int getMaxTestNameLen ()
 
String getSnapshotFilename (final int sn, String postSNDetail, final GLCapabilitiesImmutable caps, final int width, final int height, final boolean sinkHasAlpha, String fileSuffix, final String destPath)
 
void snapshot (final int sn, final String postSNDetail, final GL gl, final GLReadBufferUtil readBufferUtil, final String fileSuffix, final String destPath)
 Takes a snapshot of the drawable's current front framebuffer. More...
 

Static Public Member Functions

static void initClass ()
 
static void main (final String args[])
 
- Static Public Member Functions inherited from com.jogamp.opengl.test.junit.util.UITestCase
static void setResetXRandRIfX11AfterClass ()
 
static int resetXRandRIfX11 ()
 Iterates through all outputs and sets the preferred mode and normal rotation using RandR 1.3. More...
 
static int processCommand (final String[] cmdline, final OutputStream outstream, final StringBuilder outstring, final String outPrefix)
 
static final void oneTimeSetUpUITest ()
 
static final void oneTimeTearDownUITest ()
 

Protected Member Functions

GLCanvas createGLCanvas (final Shell shell, final Composite composite, final int x, final int y, final GearsES2 gears) throws InterruptedException
 

Detailed Description

Sharing the VBO of 3 GearsES2 instances, each in their own SWT GLCanvas.

This is achieved by using the 1st GLCanvas as the master and using the build-in blocking mechanism to postpone creation of the 2nd and 3rd GLCanvas until the 1st GLCanvas's GLContext becomes created.

Above method allows random creation of the 1st GLCanvas in theory, which triggers creation of the dependent other GLCanvas sharing it's GLContext.
However, since this test may perform on the main thread we have to initialize all in order, since otherwise the test main thread itself blocks SWT GLCanvas creation ..

On MacOS 12+ and SWT 4.26 while not using AWT (-Djava.awt.headless=true, -XstartOnFirstThread), we recently get the following Exception from SWT (suppressed):

java.lang.NullPointerException: Cannot invoke "org.eclipse.swt.internal.cocoa.NSGraphicsContext.saveGraphicsState()" because "context" is null
        at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:764)
        at org.eclipse.swt.widgets.Canvas.drawRect(Canvas.java:170)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:6287)
        at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
        at org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(Display.java:5565)
        at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5965)
        at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
        at org.eclipse.swt.internal.cocoa.NSApplication.nextEventMatchingMask(NSApplication.java:92)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3983)
        at com.jogamp.opengl.test.junit.util.SWTTestUtil$WaitAction$1.run(SWTTestUtil.java:52)
        at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:183)
        at org.eclipse.swt.widgets.Display.syncExec(Display.java:5250)
        at com.jogamp.opengl.test.junit.util.SWTTestUtil$WaitAction.run(SWTTestUtil.java:63)
        at com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3.test02AsyncEachAnimator(TestSharedContextVBOES2SWT3.java:376)
   

This is not observed if running using AWT (-Djava.awt.headless=false).

Definition at line 98 of file TestSharedContextVBOES2SWT3.java.

Member Function Documentation

◆ createGLCanvas()

GLCanvas com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3.createGLCanvas ( final Shell  shell,
final Composite  composite,
final int  x,
final int  y,
final GearsES2  gears 
) throws InterruptedException
protected

Definition at line 192 of file TestSharedContextVBOES2SWT3.java.

Here is the call graph for this function:

◆ init()

void com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3.init ( )

Definition at line 126 of file TestSharedContextVBOES2SWT3.java.

Here is the call graph for this function:

◆ initClass()

static void com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3.initClass ( )
static

Definition at line 104 of file TestSharedContextVBOES2SWT3.java.

Here is the call graph for this function:

◆ main()

static void com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3.main ( final String  args[])
static

Definition at line 408 of file TestSharedContextVBOES2SWT3.java.

◆ release()

void com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3.release ( )

Definition at line 154 of file TestSharedContextVBOES2SWT3.java.

Here is the call graph for this function:

◆ test01SyncedOneAnimator()

void com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3.test01SyncedOneAnimator ( ) throws InterruptedException

Definition at line 207 of file TestSharedContextVBOES2SWT3.java.

Here is the call graph for this function:

◆ test02AsyncEachAnimator()

void com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3.test02AsyncEachAnimator ( ) throws InterruptedException

Definition at line 292 of file TestSharedContextVBOES2SWT3.java.

Here is the call graph for this function:

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