28package com.jogamp.opengl.test.junit.jogl.acore;
30import java.awt.EventQueue;
31import java.lang.reflect.InvocationTargetException;
33import com.jogamp.opengl.GLAutoDrawable;
34import com.jogamp.opengl.GLCapabilities;
35import com.jogamp.opengl.GLDrawableFactory;
36import com.jogamp.opengl.GLProfile;
38import jogamp.nativewindow.jawt.JAWTUtil;
40import org.junit.Assert;
41import org.junit.BeforeClass;
43import org.junit.FixMethodOrder;
44import org.junit.runners.MethodSorters;
46import com.jogamp.common.util.InterruptSource;
47import com.jogamp.common.util.RunnableTask;
48import com.jogamp.opengl.test.junit.util.UITestCase;
50@FixMethodOrder(MethodSorters.NAME_ASCENDING)
53 static int width, height;
58 Assert.assertNotNull( glp );
64 caps.setPBuffer(
true);
67 final boolean[] done = {
false};
68 final Runnable pbufferCreationAction =
new Runnable() {
70 System.err.println(
"AA.1");
73 System.err.println(
"AA.X");
77 EventQueue.invokeAndWait(
new Runnable() {
79 Assert.assertTrue(EventQueue.isDispatchThread());
80 JAWTUtil.lockToolkit();
82 final RunnableTask rTask =
new RunnableTask(pbufferCreationAction,
new Object(),
false,
null);
83 System.err.println(
"BB.0: "+rTask.getSyncObject());
84 synchronized (rTask.getSyncObject()) {
85 System.err.println(
"BB.1: "+rTask.getSyncObject());
86 new InterruptSource.Thread(
null, rTask, Thread.currentThread().getName()+
"-Pbuffer_Creation").start();
88 System.err.println(
"BB.2");
89 rTask.getSyncObject().wait();
90 System.err.println(
"BB.3");
91 }
catch (
final InterruptedException e) {
92 throw new RuntimeException(e);
94 System.err.println(
"BB.X");
97 JAWTUtil.unlockToolkit();
101 Assert.assertTrue(done[0]);
105 @Test(timeout = 10000)
106 public
void testDeadlock() throws InterruptedException, InvocationTargetException {
111 static long duration = 500;
113 public static void main(
final String args[] ) {
114 for (
int i = 0; i < args.length; i++ ) {
115 if ( args[ i ].equals(
"-time" ) ) {
118 duration = Integer.parseInt( args[ i ] );
120 catch (
final Exception ex ) {
121 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 getMaxFixedFunc(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer)
Returns the highest profile, implementing the fixed function pipeline.
static void main(final String args[])
void runTestGL(final GLCapabilities caps)
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.