diff options
author | Sven Gothel <[email protected]> | 2014-09-03 23:32:52 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-09-03 23:32:52 +0200 |
commit | 101e229fa2f15b3492889205884ca98b1e9b3fbd (patch) | |
tree | 8a951d842f17ca85f48cdd0a326d2d2c1060e696 | |
parent | 71b8203572bc1bd63540818a9de4f927b0abebb1 (diff) |
Bug 1060 - Add GLProfile.isInitialized(): Returns true if JOGL has been initialized
-rw-r--r-- | make/scripts/tests.sh | 4 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLProfile.java | 15 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile00NEWT.java | 11 |
3 files changed, 28 insertions, 2 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 797aef3e3..2a9ed0bf1 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -376,9 +376,9 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLVersionParsing00NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLCanvasAWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $* +testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $* -testawt com.jogamp.opengl.test.junit.jogl.acore.TestVersionSemanticsNOUI $* +#testawt com.jogamp.opengl.test.junit.jogl.acore.TestVersionSemanticsNOUI $* # # Stereo diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 5836e4c81..08712e488 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -128,6 +128,21 @@ public class GLProfile { } /** + * @return <code>true</code> if JOGL has been initialized, i.e. manually via {@link #initSingleton()} or implicit, + * otherwise returns <code>false</code>. + * + * @since 2.2.1 + */ + public static boolean isInitialized() { + initLock.lock(); + try { + return initialized; + } finally { + initLock.unlock(); + } + } + + /** * Static initialization of JOGL. * * <p> diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile00NEWT.java index dfa34be34..69ddb7771 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile00NEWT.java @@ -58,7 +58,14 @@ public class TestGLProfile00NEWT extends UITestCase { @Test public void test02InitSingleton() throws InterruptedException { + Assert.assertFalse("JOGL is initialized before usage", GLProfile.isInitialized()); GLProfile.initSingleton(); + Assert.assertTrue("JOGL is not initialized after enforced initialization", GLProfile.isInitialized()); + } + + @Test + public void test11DumpDesktopGLInfo() throws InterruptedException { + Assert.assertTrue("JOGL is not initialized ...", GLProfile.isInitialized()); System.err.println("Desktop"); final GLDrawableFactory desktopFactory = GLDrawableFactory.getDesktopFactory(); if( null != desktopFactory ) { @@ -67,7 +74,11 @@ public class TestGLProfile00NEWT extends UITestCase { } else { System.err.println("\tNULL"); } + } + @Test + public void test12DumpEGLGLInfo() throws InterruptedException { + Assert.assertTrue("JOGL is not initialized ...", GLProfile.isInitialized()); System.err.println("EGL"); final GLDrawableFactory eglFactory = GLDrawableFactory.getEGLFactory(); if( null != eglFactory ) { |