aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/com/jogamp')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java41
5 files changed, 45 insertions, 10 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java
index 6c826c221..f3af56fb3 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java
@@ -56,7 +56,7 @@ public class TestFBOMRTNEWT01 extends UITestCase {
@Test
public void test01() throws InterruptedException {
// preset ..
- final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow(GLProfile.getGL2ES2(), 640, 480, true);
+ final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 640, 480, true);
final GLDrawable drawable = winctx.context.getGLDrawable();
final GL _gl = winctx.context.getGL();
Assert.assertTrue(_gl.isGL2GL3());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java
index c29faf31d..1cd49a41f 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java
@@ -60,7 +60,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
@Test
public void testShaderState01Validation() throws InterruptedException {
// preset ..
- final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow(GLProfile.getGL2ES2(), 480, 480, true);
+ final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 480, 480, true);
final GLDrawable drawable = winctx.context.getGLDrawable();
final GL2ES2 gl = winctx.context.getGL().getGL2ES2();
System.err.println(winctx.context);
@@ -184,7 +184,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
void testShaderState00PerformanceSingle(boolean toggleEnable) throws InterruptedException {
// preset ..
- final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow(GLProfile.getGL2ES2(), 480, 480, false);
+ final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 480, 480, false);
final GLDrawable drawable = winctx.context.getGLDrawable();
final GL2ES2 gl = winctx.context.getGL().getGL2ES2();
System.err.println(winctx.context);
@@ -270,7 +270,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
@Test
public void testShaderState01PerformanceDouble() throws InterruptedException {
// preset ..
- final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow(GLProfile.getGL2ES2(), 480, 480, false);
+ final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 480, 480, false);
final GLDrawable drawable = winctx.context.getGLDrawable();
final GL2ES2 gl = winctx.context.getGL().getGL2ES2();
System.err.println(winctx.context);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java
index 0d81db137..38fbabf72 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java
@@ -68,7 +68,7 @@ public class TestGLSLShaderState02NEWT extends UITestCase {
private void testShaderState01Validation(boolean linkSP1) throws InterruptedException {
// preset ..
- final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow(GLProfile.getGL2ES2(), 480, 480, true);
+ final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 480, 480, true);
final GLDrawable drawable = winctx.context.getGLDrawable();
final GL2ES2 gl = winctx.context.getGL().getGL2ES2();
System.err.println(winctx.context);
@@ -232,7 +232,7 @@ public class TestGLSLShaderState02NEWT extends UITestCase {
@Test
public void testShaderState01PerformanceDouble() throws InterruptedException {
// preset ..
- final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow(GLProfile.getGL2ES2(), 480, 480, false);
+ final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 480, 480, false);
final GLDrawable drawable = winctx.context.getGLDrawable();
final GL2ES2 gl = winctx.context.getGL().getGL2ES2();
System.err.println(winctx.context);
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 365596711..cc0ec4601 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
@@ -58,7 +58,7 @@ public class TestRulerNEWT01 extends UITestCase {
@Test
public void test01() throws InterruptedException {
// preset ..
- final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow(GLProfile.getGL2ES2(), 640, 480, true);
+ final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 640, 480, true);
final GLDrawable drawable = winctx.context.getGLDrawable();
final GL2ES2 gl = winctx.context.getGL().getGL2ES2();
System.err.println(winctx.context);
diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java
index b8df88901..3992c0876 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java
@@ -31,8 +31,6 @@ import com.jogamp.newt.Display;
import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.Screen;
import com.jogamp.newt.Window;
-import com.jogamp.opengl.util.GLArrayDataServer;
-import com.jogamp.opengl.util.glsl.ShaderState;
import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
@@ -56,7 +54,44 @@ public class NEWTGLContext {
}
}
- public static WindowContext createWindow(GLProfile glp, int width, int height, boolean debugGL) throws InterruptedException {
+ public static WindowContext createOffscreenWindow(GLProfile glp, int width, int height, boolean debugGL) throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setOnscreen(false);
+
+ //
+ // Create native windowing resources .. X11/Win/OSX
+ //
+ Display display = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display);
+
+ Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ Assert.assertNotNull(screen);
+
+ Window window = NewtFactory.createWindow(screen, caps);
+ Assert.assertNotNull(window);
+ window.setSize(width, height);
+ window.setVisible(true);
+ AWTRobotUtil.waitForVisible(window, true);
+ AWTRobotUtil.waitForRealized(window, true);
+
+ GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
+ GLDrawable drawable = factory.createGLDrawable(window);
+ Assert.assertNotNull(drawable);
+
+ drawable.setRealized(true);
+
+ GLContext context = drawable.createContext(null);
+ Assert.assertNotNull(context);
+
+ context.enableGLDebugMessage(debugGL);
+
+ int res = context.makeCurrent();
+ Assert.assertTrue(GLContext.CONTEXT_CURRENT_NEW==res || GLContext.CONTEXT_CURRENT==res);
+
+ return new WindowContext(window, context);
+ }
+
+ public static WindowContext createOnscreenWindow(GLProfile glp, int width, int height, boolean debugGL) throws InterruptedException {
GLCapabilities caps = new GLCapabilities(glp);
//
// Create native windowing resources .. X11/Win/OSX