summaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java114
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java24
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java22
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java69
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java64
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/GearsObject.java84
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsObjectES1.java30
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsObjectES2.java54
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java16
11 files changed, 354 insertions, 135 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java
index 05d060f0b..59bb13c87 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java
@@ -104,7 +104,7 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
// init and render one frame, which will setup the Gears display lists
sharedDrawable.display();
final GLContext ctxM = sharedDrawable.getContext();
- Assert.assertTrue("Master ctx not created", AWTRobotUtil.waitForCreated(ctxM, true));
+ Assert.assertTrue("Master ctx not created", AWTRobotUtil.waitForContextCreated(sharedDrawable, true));
Assert.assertTrue("Master Ctx is shared before shared creation", !ctxM.isShared());
Assert.assertTrue("Master Gears is shared", !sharedGears.usesSharedGears());
}
@@ -136,7 +136,7 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
glWindow.setVisible(true);
Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(glWindow.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(glWindow, true));
System.err.println("Master Context: ");
MiscUtils.dumpSharedGLContext(sharedDrawable.getContext());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java
index b2d88f8e0..5cf2e4b24 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java
@@ -93,7 +93,17 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase {
}
@Test
- public void test01SyncedCommonAnimatorSharedOffscreen() throws InterruptedException, InvocationTargetException {
+ public void test01SyncedOneAnimatorCleanDtorOrder() throws InterruptedException, InvocationTargetException {
+ syncedOneAnimator(true);
+ }
+
+ // Don't test erroneous test case !
+ // @Test
+ public void test02SyncedOneAnimatorDirtyDtorOrder() throws InterruptedException, InvocationTargetException {
+ syncedOneAnimator(false);
+ }
+
+ public void syncedOneAnimator(final boolean destroyCleanOrder) throws InterruptedException, InvocationTargetException {
final Frame f1 = new Frame();
final Animator animator = new Animator();
final GearsES2 g1 = new GearsES2(0);
@@ -128,17 +138,17 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase {
Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(c1.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(c2.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(c3.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = c1.getContext();
@@ -174,12 +184,45 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase {
}
animator.stop();
+ if( destroyCleanOrder ) {
+ System.err.println("XXX Destroy in clean order NOW");
+ } else {
+ System.err.println("XXX Destroy in creation order NOW - Driver Impl. Ma trigger driver Bug i.e. not postponing GL ctx destruction after releasing all refs.");
+ }
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ if( destroyCleanOrder ) {
+ f3.dispose();
+ } else {
+ f1.dispose();
+ }
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ if( destroyCleanOrder ) {
+ f2.dispose();
+ } else {
+ f2.dispose();
+ }
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
try {
- f1.dispose();
- f2.dispose();
- f3.dispose();
+ if( destroyCleanOrder ) {
+ f1.dispose();
+ } else {
+ f3.dispose();
+ }
} catch (Throwable t) {
throw new RuntimeException(t);
}
@@ -191,7 +234,17 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase {
}
@Test
- public void test02AsyncEachWithAnimatorSharedOffscreen() throws InterruptedException, InvocationTargetException {
+ public void test11SyncEachAnimatorCleanDtorOrder() throws InterruptedException, InvocationTargetException {
+ syncedOneAnimator(true);
+ }
+
+ // Don't test erroneous test case !
+ // @Test
+ public void test12SyncEachAnimatorDirtyDtorOrder() throws InterruptedException, InvocationTargetException {
+ asyncEachOneAnimator(false);
+ }
+
+ public void asyncEachOneAnimator(final boolean destroyCleanOrder) throws InterruptedException, InvocationTargetException {
final Frame f1 = new Frame();
final Animator a1 = new Animator();
final GearsES2 g1 = new GearsES2(0);
@@ -237,17 +290,17 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase {
Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(c1.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(c2.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(c3.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = c1.getContext();
@@ -285,12 +338,45 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase {
a2.stop();
a3.stop();
+ if( destroyCleanOrder ) {
+ System.err.println("XXX Destroy in clean order NOW");
+ } else {
+ System.err.println("XXX Destroy in creation order NOW - Driver Impl. Ma trigger driver Bug i.e. not postponing GL ctx destruction after releasing all refs.");
+ }
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ if( destroyCleanOrder ) {
+ f3.dispose();
+ } else {
+ f1.dispose();
+ }
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ if( destroyCleanOrder ) {
+ f2.dispose();
+ } else {
+ f2.dispose();
+ }
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
try {
- f1.dispose();
- f2.dispose();
- f3.dispose();
+ if( destroyCleanOrder ) {
+ f1.dispose();
+ } else {
+ f3.dispose();
+ }
} catch (Throwable t) {
throw new RuntimeException(t);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java
index fcfe4d512..07b9fd4eb 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java
@@ -93,7 +93,7 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase {
}
@Test
- public void test01SyncedCommonAnimatorSharedOffscreen() throws InterruptedException, InvocationTargetException {
+ public void test01SyncedOneAnimator() throws InterruptedException, InvocationTargetException {
final Frame f1 = new Frame();
final Animator animator = new Animator();
final GearsES2 g1 = new GearsES2(0);
@@ -128,17 +128,17 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase {
Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(c1.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(c2.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(c3.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = c1.getContext();
@@ -177,9 +177,9 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
try {
- f1.dispose();
- f2.dispose();
f3.dispose();
+ f2.dispose();
+ f1.dispose();
} catch (Throwable t) {
throw new RuntimeException(t);
}
@@ -191,7 +191,7 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase {
}
@Test
- public void test02AsyncEachWithAnimatorSharedOffscreen() throws InterruptedException, InvocationTargetException {
+ public void test02AsyncEachAnimator() throws InterruptedException, InvocationTargetException {
final Frame f1 = new Frame();
final Animator a1 = new Animator();
final GearsES2 g1 = new GearsES2(0);
@@ -237,17 +237,17 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase {
Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(c1.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(c2.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(c3.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = c1.getContext();
@@ -288,9 +288,9 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
try {
- f1.dispose();
- f2.dispose();
f3.dispose();
+ f2.dispose();
+ f1.dispose();
} catch (Throwable t) {
throw new RuntimeException(t);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java
index 76ae5c69d..a8c069f36 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java
@@ -93,7 +93,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase {
Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
glWindow.display();
- Assert.assertTrue(AWTRobotUtil.waitForCreated(glWindow.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(glWindow, true));
Assert.assertTrue("Gears not initialized", gears.waitForInit(true));
return glWindow;
@@ -183,7 +183,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase {
f1.destroy();
Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f1.getContext(), false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
{
final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
@@ -206,7 +206,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase {
f2.destroy();
Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f2.getContext(), false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
{
final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
@@ -229,7 +229,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase {
f3.destroy();
Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f3.getContext(), false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
{
final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java
index e3b1fe396..827601869 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java
@@ -120,7 +120,7 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase {
// init and render one frame, which will setup the Gears display lists
sharedDrawable.display();
final GLContext ctxM = sharedDrawable.getContext();
- Assert.assertTrue("Master ctx not created", AWTRobotUtil.waitForCreated(ctxM, true));
+ Assert.assertTrue("Master ctx not created", AWTRobotUtil.waitForContextCreated(sharedDrawable, true));
Assert.assertTrue("Master Ctx is shared before shared creation", !ctxM.isShared());
Assert.assertTrue("Master Gears not initialized", sharedGears.waitForInit(true));
Assert.assertTrue("Master Gears is shared", !sharedGears.usesSharedGears());
@@ -154,7 +154,7 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase {
glWindow.setVisible(true);
Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(glWindow.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(glWindow, true));
System.err.println("Master Context: ");
MiscUtils.dumpSharedGLContext(sharedDrawable.getContext());
@@ -193,13 +193,13 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase {
f3.destroy();
Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f1.getContext(), false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f2.getContext(), false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f3.getContext(), false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
releaseShared();
}
@@ -226,13 +226,13 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase {
f3.destroy();
Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f1.getContext(), false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f2.getContext(), false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f3.getContext(), false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
releaseShared();
}
@@ -264,13 +264,13 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase {
f3.destroy();
Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f1.getContext(), false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f2.getContext(), false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f3.getContext(), false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
releaseShared();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java
index 9b283d6cd..d9fe2a949 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java
@@ -96,7 +96,17 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase {
}
@Test
- public void test01SyncedCommonAnimatorSharedOffscreen() throws InterruptedException {
+ public void test01SyncedOneAnimatorCleanDtorOrder() throws InterruptedException {
+ syncedOneAnimator(true);
+ }
+
+ // Don't test erroneous test case !
+ // @Test
+ public void test02SyncedOneAnimatorDirtyDtorOrder() throws InterruptedException {
+ syncedOneAnimator(false);
+ }
+
+ public void syncedOneAnimator(boolean destroyCleanOrder) throws InterruptedException {
final Animator animator = new Animator();
final GearsES2 g1 = new GearsES2(0);
final GLWindow f1 = createGLWindow(0, 0, g1);
@@ -133,19 +143,20 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase {
f1.setVisible(true);
f1.display(); // kick off GLContext .. and hence f2 + f3 creation
+
Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f1.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, true));
Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f2.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, true));
Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f3.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
animator.start(); // post start animator, otherwise display will be suppressed
@@ -182,10 +193,19 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase {
e.printStackTrace();
}
animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
- f1.destroy();
- f2.destroy();
- f3.destroy();
+ if( destroyCleanOrder ) {
+ System.err.println("XXX Destroy in clean order NOW");
+ f3.destroy();
+ f2.destroy();
+ f1.destroy();
+ } else {
+ System.err.println("XXX Destroy in creation order NOW - Driver Impl. May trigger driver Bug i.e. not postponing GL ctx destruction after releasing all refs.");
+ f1.destroy();
+ f2.destroy();
+ f3.destroy();
+ }
Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
@@ -195,7 +215,17 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase {
}
@Test
- public void test02AsyncEachWithAnimatorSharedOffscreen() throws InterruptedException {
+ public void test11ASyncEachAnimatorCleanDtorOrder() throws InterruptedException {
+ asyncEachAnimator(true);
+ }
+
+ // Don't test erroneous test case !
+ // @Test
+ public void test12AsyncEachAnimatorDirtyDtorOrder() throws InterruptedException {
+ asyncEachAnimator(false);
+ }
+
+ public void asyncEachAnimator(boolean destroyCleanOrder) throws InterruptedException {
final Animator a1 = new Animator();
final GearsES2 g1 = new GearsES2(0);
final GLWindow f1 = createGLWindow(0, 0, g1);
@@ -237,16 +267,16 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase {
Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f1.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, true));
Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f2.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, true));
Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f3.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = f1.getContext();
@@ -281,12 +311,23 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase {
e.printStackTrace();
}
a1.stop();
+ Assert.assertEquals(false, a1.isAnimating());
a2.stop();
+ Assert.assertEquals(false, a2.isAnimating());
a3.stop();
+ Assert.assertEquals(false, a3.isAnimating());
- f1.destroy();
- f2.destroy();
- f3.destroy();
+ if( destroyCleanOrder ) {
+ System.err.println("XXX Destroy in clean order NOW");
+ f3.destroy();
+ f2.destroy();
+ f1.destroy();
+ } else {
+ System.err.println("XXX Destroy in creation order NOW - Driver Impl. May trigger driver Bug i.e. not postponing GL ctx destruction after releasing all refs.");
+ f1.destroy();
+ f2.destroy();
+ f3.destroy();
+ }
Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java
index e2928855c..adadf85e3 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java
@@ -93,7 +93,17 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase {
}
@Test
- public void test01SyncedCommonAnimatorSharedOffscreen() throws InterruptedException {
+ public void test01SyncedOneAnimatorCleanDtorOrder() throws InterruptedException {
+ syncedOneAnimator(true);
+ }
+
+ // Don't test erroneous test case !
+ // @Test
+ public void test02SyncedOneAnimatorDirtyDtorOrder() throws InterruptedException {
+ syncedOneAnimator(false);
+ }
+
+ public void syncedOneAnimator(boolean destroyCleanOrder) throws InterruptedException {
final Animator animator = new Animator();
final GearsES2 g1 = new GearsES2(0);
final GLWindow f1 = createGLWindow(0, 0, g1);
@@ -123,17 +133,17 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase {
Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f1.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, true));
Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f2.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, true));
Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f3.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = f1.getContext();
@@ -169,9 +179,17 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase {
}
animator.stop();
- f1.destroy();
- f2.destroy();
- f3.destroy();
+ if( destroyCleanOrder ) {
+ System.err.println("XXX Destroy in clean order NOW");
+ f3.destroy();
+ f2.destroy();
+ f1.destroy();
+ } else {
+ System.err.println("XXX Destroy in creation order NOW - Driver Impl. Ma trigger driver Bug i.e. not postponing GL ctx destruction after releasing all refs.");
+ f1.destroy();
+ f2.destroy();
+ f3.destroy();
+ }
Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
@@ -181,7 +199,17 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase {
}
@Test
- public void test02AsyncEachWithAnimatorSharedOffscreen() throws InterruptedException {
+ public void test11ASyncEachAnimatorCleanDtorOrder() throws InterruptedException {
+ asyncEachAnimator(true);
+ }
+
+ // Don't test erroneous test case !
+ // @Test
+ public void test12AsyncEachAnimatorDirtyDtorOrder() throws InterruptedException {
+ asyncEachAnimator(false);
+ }
+
+ public void asyncEachAnimator(boolean destroyCleanOrder) throws InterruptedException {
final Animator a1 = new Animator();
final GearsES2 g1 = new GearsES2(0);
final GLWindow f1 = createGLWindow(0, 0, g1);
@@ -217,17 +245,17 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase {
Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f1.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, true));
Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f2.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, true));
Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true));
- Assert.assertTrue(AWTRobotUtil.waitForCreated(f3.getContext(), true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = f1.getContext();
@@ -265,9 +293,17 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase {
a2.stop();
a3.stop();
- f1.destroy();
- f2.destroy();
- f3.destroy();
+ if( destroyCleanOrder ) {
+ System.err.println("XXX Destroy in clean order NOW");
+ f3.destroy();
+ f2.destroy();
+ f1.destroy();
+ } else {
+ System.err.println("XXX Destroy in creation order NOW - Driver Impl. May trigger driver Bug i.e. not postponing GL ctx destruction after releasing all refs.");
+ f1.destroy();
+ f2.destroy();
+ f3.destroy();
+ }
Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/GearsObject.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/GearsObject.java
index 82dd7071f..7adcce2ae 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/GearsObject.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/GearsObject.java
@@ -7,10 +7,10 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -37,7 +37,7 @@ public abstract class GearsObject {
public static final FloatBuffer blue = Buffers.newDirectFloatBuffer( new float[] { 0.2f, 0.2f, 1.0f, 0.7f } );
public static final float M_PI = (float)Math.PI;
- public final FloatBuffer gearColor;
+ public final FloatBuffer gearColor;
public GLArrayDataServer frontFace;
public GLArrayDataServer frontSide;
public GLArrayDataServer backFace;
@@ -46,10 +46,11 @@ public abstract class GearsObject {
public GLArrayDataServer insideRadiusCyl;
public boolean isShared;
+ public abstract GLArrayDataServer createInterleaveClone(GLArrayDataServer ads);
public abstract GLArrayDataServer createInterleaved(int comps, int dataType, boolean normalized, int initialSize, int vboUsage);
public abstract void addInterleavedVertexAndNormalArrays(GLArrayDataServer array, int components);
public abstract void draw(GL gl, float x, float y, float angle);
-
+
public void destroy(GL gl) {
if(!isShared) {
// could be already destroyed by shared configuration
@@ -77,21 +78,27 @@ public abstract class GearsObject {
backFace=null;
backSide=null;
outwardFace=null;
- insideRadiusCyl=null;
+ insideRadiusCyl=null;
isShared = false;
}
-
+
public GearsObject ( GearsObject shared ) {
isShared = true;
- frontFace = shared.frontFace;
- frontSide = shared.frontSide;
- backFace = shared.backFace;
- backSide = shared.backSide;
- outwardFace = shared.outwardFace;
- insideRadiusCyl = shared.insideRadiusCyl;
+ frontFace = createInterleaveClone(shared.frontFace);
+ addInterleavedVertexAndNormalArrays(frontFace, 3);
+ backFace = createInterleaveClone(shared.backFace);
+ addInterleavedVertexAndNormalArrays(backFace, 3);
+ frontSide = createInterleaveClone(shared.frontSide);
+ addInterleavedVertexAndNormalArrays(frontSide, 3);
+ backSide= createInterleaveClone(shared.backSide);
+ addInterleavedVertexAndNormalArrays(backSide, 3);
+ outwardFace = createInterleaveClone(shared.outwardFace);
+ addInterleavedVertexAndNormalArrays(outwardFace, 3);
+ insideRadiusCyl = createInterleaveClone(shared.insideRadiusCyl);
+ addInterleavedVertexAndNormalArrays(insideRadiusCyl, 3);
gearColor = shared.gearColor;
}
-
+
public GearsObject (
FloatBuffer gearColor,
float inner_radius,
@@ -100,7 +107,7 @@ public abstract class GearsObject {
int teeth,
float tooth_depth)
{
- final float dz = width * 0.5f;
+ final float dz = width * 0.5f;
int i;
float r0, r1, r2;
float angle, da;
@@ -112,7 +119,7 @@ public abstract class GearsObject {
this.isShared = false;
this.gearColor = gearColor;
-
+
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0f;
r2 = outer_radius + tooth_depth / 2.0f;
@@ -121,7 +128,7 @@ public abstract class GearsObject {
s[4] = 0; // sin(0f)
c[4] = 1; // cos(0f)
-
+
final int vboUsage = GL.GL_STATIC_DRAW;
frontFace = createInterleaved(6, GL.GL_FLOAT, false, 4*teeth+2, vboUsage);
@@ -143,45 +150,45 @@ public abstract class GearsObject {
sincos(angle + da * 1f, s, 1, c, 1);
sincos(angle + da * 2f, s, 2, c, 2);
sincos(angle + da * 3f, s, 3, c, 3);
-
+
/* front */
normal[0] = 0.0f;
normal[1] = 0.0f;
normal[2] = 1.0f;
-
+
/* front face - GL.GL_TRIANGLE_STRIP */
vert(frontFace, r0 * c[0], r0 * s[0], dz, normal);
vert(frontFace, r1 * c[0], r1 * s[0], dz, normal);
vert(frontFace, r0 * c[0], r0 * s[0], dz, normal);
vert(frontFace, r1 * c[3], r1 * s[3], dz, normal);
-
+
/* front sides of teeth - GL.GL_TRIANGLES */
vert(frontSide, r1 * c[0], r1 * s[0], dz, normal);
- vert(frontSide, r2 * c[1], r2 * s[1], dz, normal);
+ vert(frontSide, r2 * c[1], r2 * s[1], dz, normal);
vert(frontSide, r2 * c[2], r2 * s[2], dz, normal);
vert(frontSide, r1 * c[0], r1 * s[0], dz, normal);
- vert(frontSide, r2 * c[2], r2 * s[2], dz, normal);
+ vert(frontSide, r2 * c[2], r2 * s[2], dz, normal);
vert(frontSide, r1 * c[3], r1 * s[3], dz, normal);
-
+
/* back */
normal[0] = 0.0f;
normal[1] = 0.0f;
normal[2] = -1.0f;
-
+
/* back face - GL.GL_TRIANGLE_STRIP */
vert(backFace, r1 * c[0], r1 * s[0], -dz, normal);
vert(backFace, r0 * c[0], r0 * s[0], -dz, normal);
vert(backFace, r1 * c[3], r1 * s[3], -dz, normal);
vert(backFace, r0 * c[0], r0 * s[0], -dz, normal);
-
+
/* back sides of teeth - GL.GL_TRIANGLES*/
vert(backSide, r1 * c[3], r1 * s[3], -dz, normal);
vert(backSide, r2 * c[2], r2 * s[2], -dz, normal);
vert(backSide, r2 * c[1], r2 * s[1], -dz, normal);
vert(backSide, r1 * c[3], r1 * s[3], -dz, normal);
- vert(backSide, r2 * c[1], r2 * s[1], -dz, normal);
+ vert(backSide, r2 * c[1], r2 * s[1], -dz, normal);
vert(backSide, r1 * c[0], r1 * s[0], -dz, normal);
-
+
/* outward faces of teeth */
u = r2 * c[1] - r1 * c[0];
v = r2 * s[1] - r1 * s[0];
@@ -207,7 +214,7 @@ public abstract class GearsObject {
normal[0] = ( r1 * s[3] - r2 * s[2] );
normal[1] = ( r1 * c[3] - r2 * c[2] ) * -1.0f ;
vert(outwardFace, r2 * c[2], r2 * s[2], dz, normal);
- vert(outwardFace, r2 * c[2], r2 * s[2], -dz, normal);
+ vert(outwardFace, r2 * c[2], r2 * s[2], -dz, normal);
vert(outwardFace, r1 * c[3], r1 * s[3], dz, normal);
vert(outwardFace, r1 * c[3], r1 * s[3], -dz, normal);
@@ -217,7 +224,7 @@ public abstract class GearsObject {
vert(outwardFace, r1 * c[3], r1 * s[3], -dz, normal);
vert(outwardFace, r1 * c[0], r1 * s[0], dz, normal);
vert(outwardFace, r1 * c[0], r1 * s[0], -dz, normal);
-
+
/* inside radius cylinder */
normal[0] = c[0] * -1.0f;
normal[1] = s[0] * -1.0f;
@@ -232,16 +239,16 @@ public abstract class GearsObject {
vert(frontFace, r0 * c[4], r0 * s[4], dz, normal);
vert(frontFace, r1 * c[4], r1 * s[4], dz, normal);
frontFace.seal(true);
-
+
/* finish back face */
- normal[2] = -1.0f;
+ normal[2] = -1.0f;
vert(backFace, r1 * c[4], r1 * s[4], -dz, normal);
vert(backFace, r0 * c[4], r0 * s[4], -dz, normal);
backFace.seal(true);
-
+
backSide.seal(true);
frontSide.seal(true);
-
+
/* finish outward face */
sincos(da * 1f, s, 1, c, 1);
u = r2 * c[1] - r1 * c[4];
@@ -253,7 +260,7 @@ public abstract class GearsObject {
normal[1] = -u;
normal[2] = 0.0f;
vert(outwardFace, r1 * c[4], r1 * s[4], dz, normal);
- vert(outwardFace, r1 * c[4], r1 * s[4], -dz, normal);
+ vert(outwardFace, r1 * c[4], r1 * s[4], -dz, normal);
outwardFace.seal(true);
/* finish inside radius cylinder */
@@ -265,6 +272,15 @@ public abstract class GearsObject {
insideRadiusCyl.seal(true);
}
+ @Override
+ public String toString() {
+ final int ffVBO = null != frontFace ? frontFace.getVBOName() : 0;
+ final int fsVBO = null != frontSide ? frontSide.getVBOName() : 0;
+ final int bfVBO = null != backFace ? backFace.getVBOName() : 0;
+ final int bsVBO = null != backSide ? backSide.getVBOName() : 0;
+ return "GearsObj[0x"+Integer.toHexString(hashCode())+", vbo ff "+ffVBO+", fs "+fsVBO+", bf "+bfVBO+", bs "+bsVBO+"]";
+ }
+
static void vert(GLArrayDataServer array, float x, float y, float z, float n[]) {
array.putf(x);
array.putf(y);
@@ -273,7 +289,7 @@ public abstract class GearsObject {
array.putf(n[1]);
array.putf(n[2]);
}
-
+
static void sincos(float x, float sin[], int sinIdx, float cos[], int cosIdx) {
sin[sinIdx] = (float) Math.sin(x);
cos[cosIdx] = (float) Math.cos(x);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsObjectES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsObjectES1.java
index 89e469799..6c9587931 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsObjectES1.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsObjectES1.java
@@ -7,10 +7,10 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -26,7 +26,6 @@ import javax.media.opengl.GL;
import javax.media.opengl.GL2ES1;
import javax.media.opengl.fixedfunc.GLPointerFunc;
-
import com.jogamp.opengl.test.junit.jogl.demos.GearsObject;
import com.jogamp.opengl.util.GLArrayDataServer;
@@ -42,10 +41,25 @@ public class GearsObjectES1 extends GearsObject {
}
@Override
+ public GLArrayDataServer createInterleaveClone(GLArrayDataServer ads) {
+ final FloatBuffer fb0 = (FloatBuffer) ads.getBuffer();
+ final FloatBuffer fb1 = fb0.slice();
+ // manual 'unseal'
+ fb1.position(fb1.limit());
+ fb1.limit(fb1.capacity());
+
+ final GLArrayDataServer adsClone = GLArrayDataServer.createFixedInterleaved(ads.getComponentCount(), ads.getComponentType(), ads.getNormalized(),
+ ads.getStride(), fb1, ads.getVBOUsage());
+ adsClone.setVBOName(ads.getVBOName());
+ adsClone.seal(true);
+ return adsClone;
+ }
+
+ @Override
public GLArrayDataServer createInterleaved(int comps, int dataType, boolean normalized, int initialSize, int vboUsage) {
return GLArrayDataServer.createFixedInterleaved(comps, dataType, normalized, initialSize, vboUsage);
}
-
+
@Override
public void addInterleavedVertexAndNormalArrays(GLArrayDataServer array, int components) {
array.addFixedSubArray(GLPointerFunc.GL_VERTEX_ARRAY, components, GL.GL_ARRAY_BUFFER);
@@ -60,20 +74,20 @@ public class GearsObjectES1 extends GearsObject {
@Override
public void draw(GL _gl, float x, float y, float angle) {
- GL2ES1 gl = _gl.getGL2ES1();
+ GL2ES1 gl = _gl.getGL2ES1();
gl.glPushMatrix();
gl.glTranslatef(x, y, 0f);
gl.glRotatef(angle, 0f, 0f, 1f);
gl.glMaterialfv(GL2ES1.GL_FRONT_AND_BACK, GL2ES1.GL_AMBIENT_AND_DIFFUSE, gearColor);
-
+
gl.glShadeModel(GL2ES1.GL_FLAT);
draw(gl, frontFace, GL.GL_TRIANGLE_STRIP);
draw(gl, frontSide, GL.GL_TRIANGLES);
draw(gl, backFace, GL.GL_TRIANGLE_STRIP);
draw(gl, backSide, GL.GL_TRIANGLES);
draw(gl, outwardFace, GL.GL_TRIANGLE_STRIP);
- gl.glShadeModel(GL2ES1.GL_SMOOTH);
+ gl.glShadeModel(GL2ES1.GL_SMOOTH);
draw(gl, insideRadiusCyl, GL.GL_TRIANGLE_STRIP);
gl.glPopMatrix();
- }
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsObjectES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsObjectES2.java
index c5f5f7a44..89006d28c 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsObjectES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsObjectES2.java
@@ -7,10 +7,10 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -40,12 +40,12 @@ public class GearsObjectES2 extends GearsObject {
final GLUniformData pmvMatrixUniform;
final GLUniformData colorUniform;
final ShaderState st;
-
+
public GearsObjectES2(ShaderState st, FloatBuffer gearColor, float inner_radius, float outer_radius,
float width, int teeth,
- float tooth_depth,
+ float tooth_depth,
PMVMatrix pmvMatrix,
- GLUniformData pmvMatrixUniform, GLUniformData colorUniform)
+ GLUniformData pmvMatrixUniform, GLUniformData colorUniform)
{
super(gearColor, inner_radius, outer_radius, width, teeth, tooth_depth);
this.pmvMatrix = pmvMatrix;
@@ -56,9 +56,9 @@ public class GearsObjectES2 extends GearsObject {
}
public GearsObjectES2(GearsObjectES2 shared,
- ShaderState st,
+ ShaderState st,
PMVMatrix pmvMatrix,
- GLUniformData pmvMatrixUniform, GLUniformData colorUniform)
+ GLUniformData pmvMatrixUniform, GLUniformData colorUniform)
{
super(shared);
this.pmvMatrix = pmvMatrix;
@@ -67,29 +67,45 @@ public class GearsObjectES2 extends GearsObject {
this.st = st;
associate(st);
}
-
+
private void associate(ShaderState st) {
frontFace.associate(st, true);
frontSide.associate(st, true);
backFace.associate(st, true);
backSide.associate(st, true);
outwardFace.associate(st, true);
- insideRadiusCyl.associate(st, true);
+ insideRadiusCyl.associate(st, true);
+ }
+
+ @Override
+ public GLArrayDataServer createInterleaveClone(GLArrayDataServer ads) {
+ final FloatBuffer fb0 = (FloatBuffer) ads.getBuffer();
+ final FloatBuffer fb1 = fb0.slice();
+ // manual 'unseal'
+ fb1.position(fb1.limit());
+ fb1.limit(fb1.capacity());
+
+ final GLArrayDataServer adsClone = GLArrayDataServer.createGLSLInterleaved(ads.getComponentCount(), ads.getComponentType(), ads.getNormalized(),
+ ads.getStride(), fb1, ads.getVBOUsage());
+ adsClone.setVBOName(ads.getVBOName());
+ adsClone.seal(true);
+ return adsClone;
}
@Override
public GLArrayDataServer createInterleaved(int comps, int dataType, boolean normalized, int initialSize, int vboUsage) {
return GLArrayDataServer.createGLSLInterleaved(comps, dataType, normalized, initialSize, vboUsage);
}
-
+
@Override
public void addInterleavedVertexAndNormalArrays(GLArrayDataServer array, int components) {
array.addGLSLSubArray("vertices", components, GL.GL_ARRAY_BUFFER);
array.addGLSLSubArray("normals", components, GL.GL_ARRAY_BUFFER);
}
- private void draw(GL2ES2 gl, GLArrayDataServer array, int mode) {
+ private void draw(GL2ES2 gl, GLArrayDataServer array, int mode, int face) {
array.enableBuffer(gl, true);
+ // System.err.println("XXX Draw face "+face+" of "+this);
gl.glDrawArrays(mode, 0, array.getElementCount());
array.enableBuffer(gl, false);
}
@@ -109,13 +125,13 @@ public class GearsObjectES2 extends GearsObject {
colorUniform.setData(gearColor);
st.uniform(gl, colorUniform);
- draw(gl, frontFace, GL.GL_TRIANGLE_STRIP);
- draw(gl, frontSide, GL.GL_TRIANGLES);
- draw(gl, backFace, GL.GL_TRIANGLE_STRIP);
- draw(gl, backSide, GL.GL_TRIANGLES);
- draw(gl, outwardFace, GL.GL_TRIANGLE_STRIP);
- draw(gl, insideRadiusCyl, GL.GL_TRIANGLE_STRIP);
-
+ draw(gl, frontFace, GL.GL_TRIANGLE_STRIP, 0);
+ draw(gl, frontSide, GL.GL_TRIANGLES, 1);
+ draw(gl, backFace, GL.GL_TRIANGLE_STRIP, 2);
+ draw(gl, backSide, GL.GL_TRIANGLES, 3);
+ draw(gl, outwardFace, GL.GL_TRIANGLE_STRIP, 4);
+ draw(gl, insideRadiusCyl, GL.GL_TRIANGLE_STRIP, 5);
+
pmvMatrix.glPopMatrix();
- }
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
index b1e9f477e..cd14835bb 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
@@ -735,12 +735,22 @@ public class AWTRobotUtil {
*
* @return True if the GLContext becomes created or not within TIME_OUT
*/
- public static boolean waitForCreated(GLContext context, boolean created) throws InterruptedException {
- if( null == context ) {
+ public static boolean waitForContextCreated(GLAutoDrawable autoDrawable, boolean created) throws InterruptedException {
+ if( null == autoDrawable ) {
return !created;
}
int wait;
- for (wait=0; wait<POLL_DIVIDER && created != context.isCreated() ; wait++) {
+ for (wait=0; wait<POLL_DIVIDER ; wait++) {
+ final GLContext ctx = autoDrawable.getContext();
+ if( created ) {
+ if( null != ctx && ctx.isCreated() ) {
+ break;
+ }
+ } else {
+ if( null == ctx || !ctx.isCreated() ) {
+ break;
+ }
+ }
Thread.sleep(TIME_SLICE);
}
return wait<POLL_DIVIDER;