diff options
author | Sven Gothel <[email protected]> | 2014-07-10 16:50:16 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-10 16:50:16 +0200 |
commit | 22918e26ac717d661d45c764177780454f06c937 (patch) | |
tree | 358abb41eb5b85308bdac92d2246df437b5a501c | |
parent | 6e16950d5d4a87e84e34c93d44f49866183729d4 (diff) |
Refine 'GLSharedContextSetter' test cases: Use 'setSharedAutoDrawable(sharedAutoDrawable)' where possible; Fix/Refine API doc.
9 files changed, 28 insertions, 25 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 1fb4b8467..ad79a95bc 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -470,8 +470,6 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMapBufferRead01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestRedSquareES2NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT0 $* -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT3 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestBug669RecursiveGLContext01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestBug669RecursiveGLContext02NEWT $* @@ -482,13 +480,13 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT2 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES1NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT0 $* +testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT0 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT1 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT2 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT3 $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2AWT3 $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2AWT3b $* -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3 $* +#testswt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3 $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextWithJTabbedPaneAWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextNewtAWTBug523 $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListAWT $* @@ -764,7 +762,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPixelFormatUtil01NEWT $* #testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPNGTextureFromFileAWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPNGTextureFromFileNEWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTGATextureFromFileNEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTGATextureFromFileNEWT $* #testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite01AWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite01NEWT $* #testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite02AWT $* diff --git a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java index 11ed648c2..679898dca 100644 --- a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java +++ b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java @@ -110,6 +110,12 @@ public interface GLSharedContextSetter extends GLAutoDrawable { * as long it is not {@link GLContext#isCreated() created natively}. * </p> * <p> + * The <i>preferred method</i> of assigning a <i>shared context</i> is + * to {@link #setSharedAutoDrawable(GLAutoDrawable) set the shared GLAutoDrawable}, + * since this method also takes the {@link GLEventListener} + * {@link GLAutoDrawable#areAllGLEventListenerInitialized() initialization into account}. + * </p> + * <p> * See <a href="#lifecycle">Lifecycle Considerations</a>. * </p> * @@ -129,12 +135,12 @@ public interface GLSharedContextSetter extends GLAutoDrawable { * this method shall be called beforehand to have any effect. * </p> * <p> - * A set <i>sharedAutoDrawable</i> will block context creation, i.e. {@link GLAutoDrawable#initialization GLAutoDrawable initialization}, + * A set <i>sharedAutoDrawable</i> will block context creation, i.e. <a href="GLAutoDrawable.html#initialization">initialization</a> * as long it's * <ul> * <li>{@link GLContext} is <code>null</code>, or</li> * <li>{@link GLContext} has not been {@link GLContext#isCreated() created natively}, or</li> - * <li>{@link GLEventListener} are <i>not</i> {@link GLSharedContextSetter#areAllGLEventListenerInitialized() completely initialized}</li> + * <li>{@link GLEventListener} are <i>not</i> {@link GLAutoDrawable#areAllGLEventListenerInitialized() completely initialized}</li> * </ul> * </p> * <p> diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java index 1fc736ee7..7c99e2cf3 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java +++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java @@ -180,7 +180,7 @@ public class MovieSimpleActivity1 extends NewtBaseActivity { windowBounds.setWidth( wh[0] ); windowBounds.setHeight( wh[1] ); } - glWindowHUD.setSharedContext(glWindowMain.getContext()); + glWindowHUD.setSharedAutoDrawable(glWindowMain); demoHUD = new MovieSimple(mPlayerShared); mPlayerSub = mPlayerShared; } else { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java index 0469092fb..6f8d6c626 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java @@ -92,7 +92,7 @@ public class TestSharedContextListNEWT extends UITestCase { Assert.assertNotNull(glWindow); glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared); if(useShared) { - glWindow.setSharedContext(sharedDrawable.getContext()); + glWindow.setSharedAutoDrawable(sharedDrawable); } glWindow.setSize(width, height); 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 index a11ddcdb0..16467771d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java @@ -93,7 +93,7 @@ public class TestSharedContextListNEWT2 extends UITestCase { Assert.assertNotNull(glWindow); glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared); if(useShared) { - glWindow.setSharedContext(sharedDrawable.getContext()); + glWindow.setSharedAutoDrawable(sharedDrawable); } glWindow.setSize(width, height); 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 a9e7c0cc1..8f84e293d 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 @@ -120,7 +120,7 @@ public class TestSharedContextVBOES1NEWT extends UITestCase { glWindow.setPosition(x, y); glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared); if(useShared) { - glWindow.setSharedContext(sharedDrawable.getContext()); + glWindow.setSharedAutoDrawable(sharedDrawable); } glWindow.setSize(width, height); 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 3efbabb20..d2d1384e4 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 @@ -33,6 +33,7 @@ import java.util.List; import com.jogamp.newt.opengl.GLWindow; import javax.media.nativewindow.util.InsetsImmutable; +import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLContext; import javax.media.opengl.GLProfile; @@ -76,14 +77,14 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { } } - protected GLWindow runTestGL(final Animator animator, final int x, final int y, final GearsES2 gears, final GLContext sharedContext) throws InterruptedException { - final boolean useShared = null != sharedContext; + protected GLWindow runTestGL(final Animator animator, final int x, final int y, final GearsES2 gears, final GLAutoDrawable sharedDrawable) throws InterruptedException { + final boolean useShared = null != sharedDrawable; final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setPosition(x, y); glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared); if(useShared) { - glWindow.setSharedContext(sharedContext); + glWindow.setSharedAutoDrawable(sharedDrawable); } glWindow.setSize(width, height); glWindow.addGLEventListener(gears); @@ -130,7 +131,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { final GearsES2 g2 = new GearsES2(0); g2.setSharedGearsObjects(g1.getGear1(), g1.getGear2(), g1.getGear3()); final GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(), - f1.getY()+0, g2, f1.getContext()); + f1.getY()+0, g2, f1); final GLContext ctx2 = f2.getContext(); Assert.assertTrue("Ctx1 is not shared", ctx1.isShared()); Assert.assertTrue("Ctx2 is not shared", ctx2.isShared()); @@ -153,7 +154,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { final GearsES2 g3 = new GearsES2(0); g3.setSharedGearsObjects(g1.getGear1(), g1.getGear2(), g1.getGear3()); final GLWindow f3 = runTestGL(animator, f1.getX()+0, - f1.getY()+height+insets.getTotalHeight(), g3, f1.getContext()); + f1.getY()+height+insets.getTotalHeight(), g3, f1); final GLContext ctx3 = f3.getContext(); Assert.assertTrue("Ctx1 is not shared", ctx1.isShared()); 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 3a61f169e..fb15509d0 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 @@ -135,7 +135,7 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { glWindow.setPosition(x, y); glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared); if(useShared) { - glWindow.setSharedContext(sharedDrawable.getContext()); + glWindow.setSharedAutoDrawable(sharedDrawable); } glWindow.setSize(width, height); 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 1921dca60..a101c05d0 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 @@ -128,12 +128,11 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { f1.invoke(false, new GLRunnable() { @Override public boolean run(final GLAutoDrawable drawable) { - final GLContext ctx1 = f1.getContext(); - Assert.assertTrue("Ctx is shared before shared creation", !ctx1.isShared()); - f2.setSharedContext(ctx1); + Assert.assertTrue("Ctx is shared before shared creation", !f1.getContext().isShared()); + f2.setSharedAutoDrawable(f1); f2.setVisible(true); f2.display(); // kick off GLContext .. - f3.setSharedContext(ctx1); + f3.setSharedAutoDrawable(f1); f3.setVisible(true); f3.display(); // kick off GLContext .. return true; @@ -253,11 +252,10 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { f1.invoke(false, new GLRunnable() { @Override public boolean run(final GLAutoDrawable drawable) { - final GLContext ctx1 = f1.getContext(); - Assert.assertTrue("Ctx is shared before shared creation", !ctx1.isShared()); - f2.setSharedContext(ctx1); + Assert.assertTrue("Ctx is shared before shared creation", !f1.getContext().isShared()); + f2.setSharedAutoDrawable(f1); f2.setVisible(true); - f3.setSharedContext(ctx1); + f3.setSharedAutoDrawable(f1); f3.setVisible(true); return true; } |