summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java10
-rw-r--r--src/newt/classes/com/jogamp/newt/NewtFactory.java1
-rw-r--r--src/newt/classes/com/jogamp/newt/util/MainThread.java1
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java52
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java50
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedAWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java11
10 files changed, 148 insertions, 9 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index ff8d00ebe..3f9700436 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -91,7 +91,6 @@ import javax.media.opengl.GLProfile.ShutdownType;
*/
public abstract class GLDrawableFactory {
- private static final String nativeOSType;
static final String macosxFactoryClassNameCGL = "jogamp.opengl.macosx.cgl.MacOSXCGLDrawableFactory";
static final String macosxFactoryClassNameAWTCGL = "jogamp.opengl.macosx.cgl.awt.MacOSXAWTCGLDrawableFactory";
@@ -105,10 +104,6 @@ public abstract class GLDrawableFactory {
private static boolean factoryShutdownHookRegistered = false;
private static Thread factoryShutdownHook = null;
- static {
- nativeOSType = NativeWindowFactory.getNativeWindowType(true);
- }
-
/**
* Instantiate singleton factories if available, EGLES1, EGLES2 and the OS native ones.
*/
@@ -125,6 +120,7 @@ public abstract class GLDrawableFactory {
private static final void initSingletonImpl() {
registerFactoryShutdownHook();
+ final String nativeOSType = NativeWindowFactory.getNativeWindowType(true);
GLDrawableFactory tmp = null;
String factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true, AccessController.getContext());
ClassLoader cl = GLDrawableFactory.class.getClassLoader();
@@ -297,7 +293,7 @@ public abstract class GLDrawableFactory {
* Returns the sole GLDrawableFactory instance for the desktop (X11, WGL, ..) if exist or null
*/
public static GLDrawableFactory getDesktopFactory() {
- initSingleton();
+ GLProfile.initSingleton();
return nativeOSFactory;
}
@@ -305,7 +301,7 @@ public abstract class GLDrawableFactory {
* Returns the sole GLDrawableFactory instance for EGL if exist or null
*/
public static GLDrawableFactory getEGLFactory() {
- initSingleton();
+ GLProfile.initSingleton();
return eglFactory;
}
diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java
index cb1da37c7..4e6fa1aa5 100644
--- a/src/newt/classes/com/jogamp/newt/NewtFactory.java
+++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java
@@ -54,7 +54,6 @@ public class NewtFactory {
// Work-around for initialization order problems on Mac OS X
// between native Newt and (apparently) Fmod
static {
- Platform.initSingleton();
NativeWindowFactory.initSingleton(false); // last resort ..
WindowImpl.init(NativeWindowFactory.getNativeWindowType(true));
}
diff --git a/src/newt/classes/com/jogamp/newt/util/MainThread.java b/src/newt/classes/com/jogamp/newt/util/MainThread.java
index b1862834c..e71ef75ec 100644
--- a/src/newt/classes/com/jogamp/newt/util/MainThread.java
+++ b/src/newt/classes/com/jogamp/newt/util/MainThread.java
@@ -102,7 +102,6 @@ public class MainThread {
static {
final AccessControlContext localACC = AccessController.getContext();
- Platform.initSingleton();
NativeWindowFactory.initSingleton(true);
NEWTJNILibLoader.loadNEWT();
HINT_USE_MAIN_THREAD = !NativeWindowFactory.isAWTAvailable() ||
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java
new file mode 100644
index 000000000..5523ce5ce
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright 2011 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 javax.media.opengl.awt.GLCanvas;
+
+import org.junit.Test;
+
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+public class TestMainVersionGLCanvasAWT extends UITestCase {
+
+ @Test
+ public void testMain() throws InterruptedException {
+ GLCanvas.main(null);
+ }
+
+
+ public static void main(String args[]) throws IOException {
+ String tstname = TestMainVersionGLCanvasAWT.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java
new file mode 100644
index 000000000..d178e34f4
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright 2011 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 org.junit.Test;
+
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+public class TestMainVersionGLWindowNEWT extends UITestCase {
+
+ @Test
+ public void testMain() throws InterruptedException {
+ GLWindow.main(null);
+ }
+
+
+ public static void main(String args[]) throws IOException {
+ String tstname = TestMainVersionGLWindowNEWT.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java
index 72ed5742e..1713f4ad6 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java
@@ -88,9 +88,17 @@ public class TestShutdownCompleteAWT extends UITestCase {
}
protected void oneLife() throws InterruptedException, InvocationTargetException {
+ long t0 = System.nanoTime();
GLProfile.initSingleton();
+ long t1 = System.nanoTime();
runTestGL();
+ long t2 = System.nanoTime();
GLProfile.shutdown(GLProfile.ShutdownType.COMPLETE);
+ long t3 = System.nanoTime();
+ System.err.println("Total: "+ (t3-t0)/10e6 +"ms");
+ System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/10e6 +"ms");
+ System.err.println(" Demo Code: "+ (t2-t1)/10e6 +"ms");
+ System.err.println(" GLProfile.shutdown(COMPLETE): "+ (t3-t2)/10e6 +"ms");
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java
index 113448e4f..15fe5b3fd 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java
@@ -72,9 +72,17 @@ public class TestShutdownCompleteNEWT extends UITestCase {
}
protected void oneLife() throws InterruptedException {
+ long t0 = System.nanoTime();
GLProfile.initSingleton();
+ long t1 = System.nanoTime();
runTestGL();
+ long t2 = System.nanoTime();
GLProfile.shutdown(GLProfile.ShutdownType.COMPLETE);
+ long t3 = System.nanoTime();
+ System.err.println("Total: "+ (t3-t0)/10e6 +"ms");
+ System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/10e6 +"ms");
+ System.err.println(" Demo Code: "+ (t2-t1)/10e6 +"ms");
+ System.err.println(" GLProfile.shutdown(COMPLETE): "+ (t3-t2)/10e6 +"ms");
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedAWT.java
index cf443073a..cc20a20e9 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedAWT.java
@@ -87,9 +87,17 @@ public class TestShutdownSharedAWT extends UITestCase {
}
protected void oneLife() throws InterruptedException, InvocationTargetException {
+ long t0 = System.nanoTime();
GLProfile.initSingleton();
+ long t1 = System.nanoTime();
runTestGL();
+ long t2 = System.nanoTime();
GLProfile.shutdown(GLProfile.ShutdownType.SHARED_ONLY);
+ long t3 = System.nanoTime();
+ System.err.println("Total: "+ (t3-t0)/10e6 +"ms");
+ System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/10e6 +"ms");
+ System.err.println(" Demo Code: "+ (t2-t1)/10e6 +"ms");
+ System.err.println(" GLProfile.shutdown(SHARED): "+ (t3-t2)/10e6 +"ms");
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java
index f151aec04..8fc7f0db6 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java
@@ -72,9 +72,17 @@ public class TestShutdownSharedNEWT extends UITestCase {
}
protected void oneLife() throws InterruptedException {
+ long t0 = System.nanoTime();
GLProfile.initSingleton();
+ long t1 = System.nanoTime();
runTestGL();
+ long t2 = System.nanoTime();
GLProfile.shutdown(GLProfile.ShutdownType.SHARED_ONLY);
+ long t3 = System.nanoTime();
+ System.err.println("Total: "+ (t3-t0)/10e6 +"ms");
+ System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/10e6 +"ms");
+ System.err.println(" Demo Code: "+ (t2-t1)/10e6 +"ms");
+ System.err.println(" GLProfile.shutdown(SHARED): "+ (t3-t2)/10e6 +"ms");
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java
index f0a77237b..255e5c051 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java
@@ -59,6 +59,9 @@ public class TestRulerNEWT01 extends UITestCase {
@Test
public void test01() throws InterruptedException {
+ long t0 = System.nanoTime();
+ GLProfile.initSingleton();
+ long t1 = System.nanoTime();
// preset ..
final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 640, 480, true);
final GLDrawable drawable = winctx.context.getGLDrawable();
@@ -156,7 +159,15 @@ public class TestRulerNEWT01 extends UITestCase {
Thread.sleep(durationPerTest/10);
}
+ long t2 = System.nanoTime();
+
NEWTGLContext.destroyWindow(winctx);
+
+ long t3 = System.nanoTime();
+
+ System.err.println("t1-t0: "+ (t1-t0)/10e6 +"ms");
+ System.err.println("t3-t0: "+ (t3-t0)/10e6 +"ms");
+ System.err.println("t3-t2: "+ (t3-t2)/10e6 +"ms");
}
public static void main(String args[]) throws IOException {