diff options
author | Sven Gothel <[email protected]> | 2012-05-16 09:01:29 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-05-16 09:01:29 +0200 |
commit | 9c1385ba05d8996ecd16d9b9e9e40fc87c97500a (patch) | |
tree | 1822fd9197cd9c7cf57076861ced86236c6b504e | |
parent | 9729f4408a1f340acd2a49e8f86b397e7a6b1b6f (diff) |
Unit Test Util NEWTGLContext: Pass GLCapabilities instead of GLProfile, allowing custom pixelformat caps.
8 files changed, 31 insertions, 17 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java index 4fa587ed4..bebe3531e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java @@ -37,6 +37,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.GL; import javax.media.opengl.GL2GL3; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLDrawable; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; @@ -56,7 +57,8 @@ public class TestGPUMemSec01NEWT extends UITestCase { } static NEWTGLContext.WindowContext createCurrentGLOffscreenWindow(GLProfile glp, int width, int height) throws GLException, InterruptedException { - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOffscreenWindow(glp, width, height, true); + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOffscreenWindow( + new GLCapabilities(glp), width, height, true); final GL gl = winctx.context.getGL(); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java index d264d4251..158c2aa90 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java @@ -37,6 +37,7 @@ import java.nio.ByteOrder; import javax.media.opengl.GL; import javax.media.opengl.GL2GL3; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; import org.junit.Assert; @@ -70,7 +71,8 @@ public class TestMapBufferRead01NEWT extends UITestCase { } private void testWriteRead01(ByteBuffer verticiesBB) throws InterruptedException { - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOffscreenWindow(GLProfile.getGL2GL3(), 800, 600, true); + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOffscreenWindow( + new GLCapabilities(GLProfile.getGL2GL3()), 800, 600, true); final GL gl = winctx.context.getGL(); int[] vertexBuffer = new int[1]; 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 9b26b467e..1b33866d7 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 @@ -43,6 +43,7 @@ import java.io.IOException; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; import javax.media.opengl.GL2GL3; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLDrawable; import javax.media.opengl.GLPipelineFactory; import javax.media.opengl.GLProfile; @@ -61,7 +62,8 @@ public class TestFBOMRTNEWT01 extends UITestCase { System.err.println("Test requires GL2/GL3 profile."); return; } - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2GL3(), 640, 480, true); + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + new GLCapabilities(GLProfile.getGL2GL3()), 640, 480, true); final GLDrawable drawable = winctx.context.getGLDrawable(); GL2GL3 gl = winctx.context.getGL().getGL2GL3(); gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ).getGL2GL3(); 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 fb05e26d0..881399ddb 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 @@ -40,6 +40,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase; import java.io.IOException; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLDrawable; import javax.media.opengl.GLProfile; import javax.media.opengl.GLUniformData; @@ -62,7 +63,8 @@ public class TestGLSLShaderState01NEWT extends UITestCase { @Test public void testShaderState01Validation() throws InterruptedException { // preset .. - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 480, 480, true); + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + new GLCapabilities(GLProfile.getGL2ES2()), 480, 480, true); final GLDrawable drawable = winctx.context.getGLDrawable(); final GL2ES2 gl = winctx.context.getGL().getGL2ES2(); System.err.println(winctx.context); @@ -190,7 +192,8 @@ public class TestGLSLShaderState01NEWT extends UITestCase { void testShaderState00PerformanceSingle(boolean toggleEnable) throws InterruptedException { // preset .. - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 480, 480, false); + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + new GLCapabilities(GLProfile.getGL2ES2()), 480, 480, false); final GLDrawable drawable = winctx.context.getGLDrawable(); final GL2ES2 gl = winctx.context.getGL().getGL2ES2(); System.err.println(winctx.context); @@ -278,7 +281,8 @@ public class TestGLSLShaderState01NEWT extends UITestCase { @Test(timeout=240000) public void testShaderState01PerformanceDouble() throws InterruptedException { // preset .. - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 480, 480, false); + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + new GLCapabilities(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 645096554..6421c2405 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 @@ -40,6 +40,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase; import java.io.IOException; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLDrawable; import javax.media.opengl.GLProfile; import javax.media.opengl.GLUniformData; @@ -69,7 +70,8 @@ public class TestGLSLShaderState02NEWT extends UITestCase { private void testShaderState01Validation(boolean linkSP1) throws InterruptedException { // preset .. - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 480, 480, true); + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + new GLCapabilities(GLProfile.getGL2ES2()), 480, 480, true); final GLDrawable drawable = winctx.context.getGLDrawable(); final GL2ES2 gl = winctx.context.getGL().getGL2ES2(); System.err.println(winctx.context); @@ -238,7 +240,8 @@ public class TestGLSLShaderState02NEWT extends UITestCase { @Test(timeout=240000) public void testShaderState01PerformanceDouble() throws InterruptedException { // preset .. - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 480, 480, false); + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + new GLCapabilities(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 f6e46da6e..4cbccbda8 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 @@ -46,6 +46,7 @@ import java.nio.FloatBuffer; import javax.media.nativewindow.util.DimensionImmutable; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLDrawable; import javax.media.opengl.GLProfile; import javax.media.opengl.GLUniformData; @@ -63,7 +64,8 @@ public class TestRulerNEWT01 extends UITestCase { GLProfile.initSingleton(); long t1 = System.nanoTime(); // preset .. - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 640, 480, true); + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + new GLCapabilities(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/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java index 685ceeb2a..3be08971b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java @@ -9,6 +9,7 @@ import java.io.PrintStream; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; import javax.media.opengl.GL3; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; @@ -83,7 +84,8 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase { final static String glps = GLProfile.GL3; private NEWTGLContext.WindowContext prepareTest() throws GLException, InterruptedException { - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getMaxProgrammable(true), 480, 480, debugGL); + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + new GLCapabilities(GLProfile.getMaxProgrammable(true)), 480, 480, debugGL); if(!winctx.context.getGL().isGL3()) { System.err.println("GL3 not available"); cleanupTest(winctx); 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 c74d2eaa7..4edac15ed 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java +++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java @@ -36,7 +36,6 @@ import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawable; import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLProfile; import org.junit.Assert; @@ -52,8 +51,7 @@ public class NEWTGLContext { } } - public static WindowContext createOffscreenWindow(GLProfile glp, int width, int height, boolean debugGL) throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + public static WindowContext createOffscreenWindow(GLCapabilities caps, int width, int height, boolean debugGL) throws InterruptedException { caps.setOnscreen(false); caps.setPBuffer(true); @@ -73,7 +71,7 @@ public class NEWTGLContext { AWTRobotUtil.waitForVisible(window, true); AWTRobotUtil.waitForRealized(window, true); - GLDrawableFactory factory = GLDrawableFactory.getFactory(glp); + GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); GLDrawable drawable = factory.createGLDrawable(window); Assert.assertNotNull(drawable); @@ -91,8 +89,7 @@ public class NEWTGLContext { return new WindowContext(window, context); } - public static WindowContext createOnscreenWindow(GLProfile glp, int width, int height, boolean debugGL) throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + public static WindowContext createOnscreenWindow(GLCapabilities caps, int width, int height, boolean debugGL) throws InterruptedException { // // Create native windowing resources .. X11/Win/OSX // @@ -109,7 +106,7 @@ public class NEWTGLContext { Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true)); - GLDrawableFactory factory = GLDrawableFactory.getFactory(glp); + GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); GLDrawable drawable = factory.createGLDrawable(window); Assert.assertNotNull(drawable); |