28package com.jogamp.opengl.test.junit.jogl.acore;
30import java.awt.EventQueue;
31import java.lang.reflect.InvocationTargetException;
33import com.jogamp.opengl.DefaultGLCapabilitiesChooser;
34import com.jogamp.opengl.GLCapabilities;
35import com.jogamp.opengl.GLDrawableFactory;
36import com.jogamp.opengl.GLOffscreenAutoDrawable;
37import com.jogamp.opengl.GLProfile;
39import jogamp.nativewindow.jawt.JAWTUtil;
41import org.junit.Assert;
42import org.junit.BeforeClass;
44import org.junit.FixMethodOrder;
45import org.junit.runners.MethodSorters;
47import com.jogamp.common.util.InterruptSource;
48import com.jogamp.common.util.RunnableTask;
49import com.jogamp.opengl.test.junit.util.UITestCase;
51@FixMethodOrder(MethodSorters.NAME_ASCENDING)
54 static int width, height;
59 Assert.assertNotNull( glp );
68 final boolean[] done = {
false};
69 final Runnable pbufferCreationAction =
new Runnable() {
71 System.err.println(
"AA.1");
74 System.err.println(
"AA.X");
78 EventQueue.invokeAndWait(
new Runnable() {
80 Assert.assertTrue(EventQueue.isDispatchThread());
81 JAWTUtil.lockToolkit();
83 final RunnableTask rTask =
new RunnableTask(pbufferCreationAction,
new Object(),
false,
null);
84 System.err.println(
"BB.0: "+rTask.getSyncObject());
85 synchronized (rTask.getSyncObject()) {
86 System.err.println(
"BB.1: "+rTask.getSyncObject());
87 new InterruptSource.Thread(
null, rTask, Thread.currentThread().getName()+
"-Pbuffer_Creation").start();
89 System.err.println(
"BB.2");
90 rTask.getSyncObject().wait();
91 System.err.println(
"BB.3");
92 }
catch (
final InterruptedException e) {
93 throw new RuntimeException(e);
95 System.err.println(
"BB.X");
98 JAWTUtil.unlockToolkit();
102 Assert.assertTrue(done[0]);
106 @Test(timeout = 10000)
107 public
void testDeadlock() throws InterruptedException, InvocationTargetException {
112 static long duration = 500;
114 public static void main(
final String args[] ) {
115 for (
int i = 0; i < args.length; i++ ) {
116 if ( args[ i ].equals(
"-time" ) ) {
119 duration = Integer.parseInt( args[ i ] );
121 catch (
final Exception ex ) {
122 ex.printStackTrace();
Specifies a set of OpenGL capabilities.
abstract GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, GLCapabilitiesChooser chooser, int width, int height)
Creates a realized GLOffscreenAutoDrawable incl it's offscreen NativeSurface with the given capabilit...
static GLDrawableFactory getFactory(final GLProfile glProfile)
Returns the sole GLDrawableFactory instance.
Specifies the the OpenGL profile.
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
void runTestGL(final GLCapabilities caps)
static void main(final String args[])
void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
Platform-independent GLAutoDrawable specialization, exposing offscreen functionality.