summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLContext.java34
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java23
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java5
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java24
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java157
10 files changed, 225 insertions, 55 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index fd34d8ac4..9611a1651 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -458,7 +458,17 @@ public abstract class GLContextImpl extends GLContext {
if (!isCreated()) {
GLProfile.initProfiles(
getGLDrawable().getNativeSurface().getGraphicsConfiguration().getScreen().getDevice());
- newCreated = createImpl(); // may throws exception if fails!
+ final GLContextImpl shareWith = (GLContextImpl) GLContextShareSet.getShareContext(this);
+ if (null != shareWith) {
+ shareWith.getDrawableImpl().lockSurface();
+ }
+ try {
+ newCreated = createImpl(shareWith); // may throws exception if fails!
+ } finally {
+ if (null != shareWith) {
+ shareWith.getDrawableImpl().unlockSurface();
+ }
+ }
if (DEBUG) {
if(newCreated) {
System.err.println(getThreadName() + ": !!! Create GL context OK: " + toHexString(contextHandle) + " for " + getClass().getName());
@@ -485,7 +495,7 @@ public abstract class GLContextImpl extends GLContext {
}
}
protected abstract void makeCurrentImpl(boolean newCreatedContext) throws GLException;
- protected abstract boolean createImpl() throws GLException ;
+ protected abstract boolean createImpl(GLContextImpl sharedWith) throws GLException ;
/**
* Platform dependent but harmonized implementation of the <code>ARB_create_context</code>
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index 7c72e0d29..6af35e3aa 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -35,17 +35,20 @@
package jogamp.opengl.egl;
-import javax.media.opengl.*;
+import java.nio.ByteBuffer;
+import java.util.Map;
-import jogamp.opengl.*;
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
+import javax.media.nativewindow.AbstractGraphicsDevice;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLException;
+import javax.media.opengl.GLProfile;
+
+import jogamp.opengl.GLContextImpl;
+import jogamp.opengl.GLDrawableImpl;
import com.jogamp.gluegen.runtime.ProcAddressTable;
import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver;
-import java.nio.*;
-import java.util.*;
-
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
public abstract class EGLContext extends GLContextImpl {
private boolean eglQueryStringInitialized;
@@ -135,12 +138,12 @@ public abstract class EGLContext extends GLContextImpl {
// FIXME
}
- protected boolean createImpl() throws GLException {
+ protected boolean createImpl(GLContextImpl shareWith) throws GLException {
long eglDisplay = ((EGLDrawable)drawable).getDisplay();
EGLGraphicsConfiguration config = ((EGLDrawable)drawable).getGraphicsConfiguration();
GLProfile glProfile = drawable.getGLProfile();
long eglConfig = config.getNativeConfig();
- long shareWith = EGL.EGL_NO_CONTEXT;
+ long shareWithHandle = EGL.EGL_NO_CONTEXT;
if (eglDisplay == 0) {
throw new GLException("Error: attempted to create an OpenGL context without a display connection");
@@ -160,10 +163,9 @@ public abstract class EGLContext extends GLContextImpl {
}
}
- EGLContext other = (EGLContext) GLContextShareSet.getShareContext(this);
- if (other != null) {
- shareWith = other.getHandle();
- if (shareWith == 0) {
+ if (shareWith != null) {
+ shareWithHandle = shareWith.getHandle();
+ if (shareWithHandle == 0) {
throw new GLException("GLContextShareSet returned an invalid OpenGL context");
}
}
@@ -179,10 +181,10 @@ public abstract class EGLContext extends GLContextImpl {
} else {
throw new GLException("Error creating OpenGL context - invalid GLProfile: "+glProfile);
}
- contextHandle = EGL.eglCreateContext(eglDisplay, eglConfig, shareWith, contextAttrs, 0);
+ contextHandle = EGL.eglCreateContext(eglDisplay, eglConfig, shareWithHandle, contextAttrs, 0);
if (contextHandle == 0) {
throw new GLException("Error creating OpenGL context: eglDisplay "+toHexString(eglDisplay)+
- ", eglConfig "+config+", "+glProfile+", shareWith "+toHexString(shareWith)+", error "+toHexString(EGL.eglGetError()));
+ ", eglConfig "+config+", "+glProfile+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError()));
}
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Created OpenGL context 0x" +
@@ -190,7 +192,7 @@ public abstract class EGLContext extends GLContextImpl {
",\n\twrite surface 0x" + Long.toHexString(drawable.getHandle()) +
",\n\tread surface 0x" + Long.toHexString(drawableRead.getHandle())+
",\n\t"+this+
- ",\n\tsharing with 0x" + Long.toHexString(shareWith));
+ ",\n\tsharing with 0x" + Long.toHexString(shareWithHandle));
}
if (!EGL.eglMakeCurrent(((EGLDrawable)drawable).getDisplay(),
drawable.getHandle(),
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index d5ce6a196..d063c3a7b 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -54,7 +54,6 @@ import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
import jogamp.opengl.GLContextImpl;
-import jogamp.opengl.GLContextShareSet;
import jogamp.opengl.GLDrawableImpl;
import jogamp.opengl.GLGraphicsConfigurationUtil;
import jogamp.opengl.macosx.cgl.MacOSXCGLDrawable.GLBackendType;
@@ -204,35 +203,35 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return false;
}
- protected long createImplPreset() throws GLException {
- MacOSXCGLContext other = (MacOSXCGLContext) GLContextShareSet.getShareContext(this);
+ protected long createImplPreset(GLContextImpl shareWith) throws GLException {
long share = 0;
- if (other != null) {
+ if (shareWith != null) {
// Change our OpenGL mode to match that of any share context before we create ourselves
- setOpenGLMode(other.getOpenGLMode());
- share = other.getHandle();
+ setOpenGLMode(((MacOSXCGLContext)shareWith).getOpenGLMode());
+ share = shareWith.getHandle();
if (share == 0) {
throw new GLException("GLContextShareSet returned a NULL OpenGL context");
}
}
+
MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
GLCapabilitiesImmutable capabilitiesChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities();
- if (capabilitiesChosen.getPbufferFloatingPointBuffers() &&
- !isTigerOrLater) {
+ if (capabilitiesChosen.getPbufferFloatingPointBuffers() && !isTigerOrLater) {
throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later");
}
GLProfile glp = capabilitiesChosen.getGLProfile();
if(glp.isGLES1() || glp.isGLES2() || glp.isGL4() || glp.isGL3() && !isLionOrLater) {
throw new GLException("OpenGL profile not supported on MacOSX "+Platform.getOSVersionNumber()+": "+glp);
}
+
if (DEBUG) {
System.err.println("!!! Share context is " + toHexString(share) + " for " + this);
}
- return share;
+ return share;
}
-
- protected boolean createImpl() throws GLException {
- long share = createImplPreset();
+
+ protected boolean createImpl(GLContextImpl shareWith) throws GLException {
+ long share = createImplPreset(shareWith);
contextHandle = createContextARB(share, true);
return 0 != contextHandle;
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
index ba384fc71..2b24ed378 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
@@ -50,6 +50,7 @@ import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
import jogamp.nativewindow.WrappedSurface;
+import jogamp.opengl.GLContextImpl;
import jogamp.opengl.GLContextShareSet;
import jogamp.opengl.macosx.cgl.MacOSXCGLDrawable.GLBackendType;
@@ -117,7 +118,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
return new MacOSXExternalCGLContext(new Drawable(factory, ns), isNSContext, contextHandle);
}
- protected boolean createImpl() throws GLException {
+ protected boolean createImpl(GLContextImpl shareWith) throws GLException {
return true;
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
index 4fe6fa484..6de94085f 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
@@ -42,6 +42,8 @@ package jogamp.opengl.macosx.cgl;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLException;
+import jogamp.opengl.GLContextImpl;
+
public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
public MacOSXOnscreenCGLContext(MacOSXOnscreenCGLDrawable drawable,
@@ -72,8 +74,8 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
}
@Override
- protected boolean createImpl() {
- boolean res = super.createImpl();
+ protected boolean createImpl(GLContextImpl sharedWith) {
+ boolean res = super.createImpl(sharedWith);
lastWidth = -1;
lastHeight = -1;
if(res && isNSContext()) {
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
index ae58f6811..a9376fb34 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
@@ -44,6 +44,7 @@ import java.awt.Graphics;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLException;
+import jogamp.opengl.GLContextImpl;
import jogamp.opengl.awt.Java2D;
import jogamp.opengl.awt.Java2DGLContext;
import jogamp.opengl.macosx.cgl.MacOSXCGLContext;
@@ -79,8 +80,8 @@ public class MacOSXJava2DCGLContext extends MacOSXCGLContext implements Java2DGL
}
}
- protected boolean createImpl() {
- long share = createImplPreset();
+ protected boolean createImpl(GLContextImpl shareWith) {
+ long share = createImplPreset(shareWith);
long ctx = Java2D.createOGLContextOnSurface(graphics, share);
if (ctx == 0) {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
index 90b7fa949..300b5c5c7 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
@@ -55,7 +55,6 @@ import com.jogamp.gluegen.runtime.ProcAddressTable;
import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver;
import jogamp.nativewindow.windows.GDI;
import jogamp.opengl.GLContextImpl;
-import jogamp.opengl.GLContextShareSet;
import jogamp.opengl.GLDrawableImpl;
public class WindowsWGLContext extends GLContextImpl {
@@ -257,20 +256,19 @@ public class WindowsWGLContext extends GLContextImpl {
* Creates and initializes an appropriate OpenGL context. Should only be
* called by {@link #makeCurrentImpl()}.
*/
- protected boolean createImpl() {
- WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl();
+ protected boolean createImpl(GLContextImpl shareWith) {
AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration();
AbstractGraphicsDevice device = config.getScreen().getDevice();
+ WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl();
WindowsWGLContext sharedContext = (WindowsWGLContext) factory.getOrCreateSharedContextImpl(device);
GLCapabilitiesImmutable glCaps = drawable.getChosenGLCapabilities();
isGLReadDrawableAvailable(); // trigger setup wglGLReadDrawableAvailable
// Windows can set up sharing of display lists after creation time
- WindowsWGLContext other = (WindowsWGLContext) GLContextShareSet.getShareContext(this);
long share = 0;
- if (other != null) {
- share = other.getHandle();
+ if (null != shareWith) {
+ share = shareWith.getHandle();
if (share == 0) {
throw new GLException("GLContextShareSet returned an invalid OpenGL context");
}
@@ -347,17 +345,19 @@ public class WindowsWGLContext extends GLContextImpl {
WGL.wglDeleteContext(contextHandle);
throw new GLException("Error making old context current: 0x" + toHexString(contextHandle) + ", werr: " + GDI.GetLastError());
}
+ if(0!=share) {
+ // Only utilize the classic GDI 'wglShareLists' shared context method
+ // for traditional non ARB context.
+ if (!WGL.wglShareLists(share, contextHandle)) {
+ throw new GLException("wglShareLists(" + toHexString(share) +
+ ", " + toHexString(contextHandle) + ") failed: werr " + GDI.GetLastError());
+ }
+ }
if (DEBUG) {
System.err.println(getThreadName() + ": createImpl: OK (old) share "+share);
}
}
- if(0!=share) {
- if (!WGL.wglShareLists(share, contextHandle)) {
- throw new GLException("wglShareLists(" + toHexString(share) +
- ", " + toHexString(contextHandle) + ") failed: werr " + GDI.GetLastError());
- }
- }
return true;
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
index e79c8b66c..70881a040 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
@@ -95,7 +95,7 @@ public class X11ExternalGLXContext extends X11GLXContext {
return new X11ExternalGLXContext(new Drawable(factory, ns), ctx);
}
- protected boolean createImpl() {
+ protected boolean createImpl(GLContextImpl shareWith) {
return true;
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index 6214c98e7..d3507cbaa 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -56,7 +56,6 @@ import javax.media.opengl.GLProfile;
import jogamp.nativewindow.x11.X11Lib;
import jogamp.nativewindow.x11.X11Util;
import jogamp.opengl.GLContextImpl;
-import jogamp.opengl.GLContextShareSet;
import jogamp.opengl.GLDrawableImpl;
import com.jogamp.common.nio.Buffers;
@@ -262,17 +261,17 @@ public abstract class X11GLXContext extends GLContextImpl {
return ctx;
}
- protected boolean createImpl() {
+ protected boolean createImpl(GLContextImpl shareWith) {
// covers the whole context creation loop incl createContextARBImpl and destroyContextARBImpl
X11Util.setX11ErrorHandler(true, true);
try {
- return createImplRaw();
+ return createImplRaw(shareWith);
} finally {
X11Util.setX11ErrorHandler(false, false);
}
}
- private boolean createImplRaw() {
+ private boolean createImplRaw(GLContextImpl shareWith) {
boolean direct = true; // try direct always
isDirect = false; // fall back
@@ -282,10 +281,9 @@ public abstract class X11GLXContext extends GLContextImpl {
X11GLXContext sharedContext = (X11GLXContext) factory.getOrCreateSharedContextImpl(device);
long display = device.getHandle();
- X11GLXContext other = (X11GLXContext) GLContextShareSet.getShareContext(this);
long share = 0;
- if (other != null) {
- share = other.getHandle();
+ if (shareWith != null) {
+ share = shareWith.getHandle();
if (share == 0) {
throw new GLException("GLContextShareSet returned an invalid OpenGL context");
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java
new file mode 100644
index 000000000..036cacac0
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java
@@ -0,0 +1,157 @@
+/**
+ * Copyright 2010 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+// package com.jogamp.opengl.test.junit.jogl.acore;
+
+import java.io.IOException;
+
+import com.jogamp.newt.opengl.GLWindow;
+
+import javax.media.nativewindow.util.InsetsImmutable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.util.Animator;
+
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestSharedContextListNEWT2 extends UITestCase {
+ static GLProfile glp;
+ static GLCapabilities caps;
+ static int width, height;
+ GLWindow sharedDrawable;
+ Gears sharedGears;
+
+ @BeforeClass
+ public static void initClass() {
+ GLProfile.initSingleton(true);
+ glp = GLProfile.get(GLProfile.GL2);
+ Assert.assertNotNull(glp);
+ caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ width = 256;
+ height = 256;
+ }
+
+ private void initShared() {
+ sharedDrawable = GLWindow.create(caps);
+ Assert.assertNotNull(sharedDrawable);
+ sharedGears = new Gears();
+ Assert.assertNotNull(sharedGears);
+ sharedDrawable.addGLEventListener(sharedGears);
+ sharedDrawable.setSize(width, height);
+ sharedDrawable.setVisible(true);
+ // init and render one frame, which will setup the Gears display lists
+ sharedDrawable.display();
+ }
+
+ private void releaseShared() {
+ Assert.assertNotNull(sharedDrawable);
+ sharedDrawable.destroy();
+ sharedDrawable = null;
+ }
+
+ protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) throws InterruptedException {
+ GLWindow glWindow = GLWindow.create(caps);
+
+ Assert.assertNotNull(glWindow);
+ glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared);
+ if(useShared) {
+ glWindow.setSharedContext(sharedDrawable.getContext());
+ }
+
+ glWindow.setSize(width, height);
+
+ Gears gears = new Gears(vsync ? 1 : 0);
+ if(useShared) {
+ gears.setGears(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3());
+ }
+ glWindow.addGLEventListener(gears);
+
+ animator.add(glWindow);
+ animator.start();
+ glWindow.setVisible(true);
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
+ glWindow.setPosition(x, y);
+
+ return glWindow;
+ }
+
+ @Test
+ public void test01() throws InterruptedException {
+ initShared();
+ GLWindow f1 = runTestGL(new Animator(), 0, 0, true, false);
+ InsetsImmutable insets = f1.getInsets();
+ GLWindow f2 = runTestGL(new Animator(), f1.getX()+width+insets.getTotalWidth(),
+ f1.getY()+0, true, false);
+ GLWindow f3 = runTestGL(new Animator(), f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), true, false);
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ // here we go again: On AMD/X11 the create/destroy sequence must be the same
+ // even though this is against the chicken/egg logic here ..
+ releaseShared();
+
+ f1.destroy();
+ f2.destroy();
+ f3.destroy();
+
+ // see above ..
+ // releaseShared();
+ }
+
+ static long duration = 2000; // ms
+
+ public static void main(String args[]) throws IOException {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ /**
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ System.err.println(stdin.readLine()); */
+ org.junit.runner.JUnitCore.main(TestSharedContextListNEWT2.class.getName());
+ }
+}