diff options
author | Sven Gothel <[email protected]> | 2014-09-14 01:18:25 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-09-14 01:18:25 +0200 |
commit | 500ed18de822527acdd10f9295122ad3b3e7762b (patch) | |
tree | d148d80d0102fbe669b55bc2609c35409a1407cc | |
parent | 026dd9a12058257483bbff1259dd89bf2040ddab (diff) |
Tests: Util NEWTGLContext: Utilize common createWindow(..) function, switch on-/offscreen via capabilities (Fixes TestTextRendererNEWTBugXXXX)
TestTextRendererNEWTBugXXXX used NEWTGLContext.createOffscreenWindow(..) which created an pbuffer based offscreen
not capable of ES2 rendering etc.
Offscreen tests use NEWTGLContext.createWindow(..) w/ caps.setOnscreen(false),
hence favor FBO instances.
10 files changed, 33 insertions, 64 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 6054f824f..b43a9f4d5 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -227,6 +227,7 @@ function jrun() { #D_ARGS="-Xprof" #D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel" + #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.debug.Animator" #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.gljpanel.noglsl" #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.debug.FBObject.MaxTextureSize=512" #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.gljpanel.noglsl -Djogl.debug.FBObject.MaxTextureSize=512" @@ -420,7 +421,7 @@ function testawtswt() { #testswt com.jogamp.opengl.test.junit.jogl.demos.es2.swt.TestGearsES2SWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWTAnalyzeBug455 $* -#testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsGLJPanelAWT $* +testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsGLJPanelAWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsGLJPanelAWTBug450 $* #testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNewtAWTWrapper $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNEWT $* @@ -811,7 +812,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.graph.demos.ui.UINewtDemo01 $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPURegionNewtDemo $* -testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo $* +#testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo $* #testawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtCanvasAWTDemo $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $* diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java index 4cfa8d9e5..c0753ba85 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java @@ -156,7 +156,7 @@ public class TestTextRendererNEWT10 extends UITestCase { System.err.println("Requested: "+caps); System.err.println("Requested: "+Region.getRenderModeString(renderModes)); - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(caps, 800, 400, true); + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow(caps, 800, 400, true); final GLDrawable drawable = winctx.context.getGLDrawable(); final GL2ES2 gl = winctx.context.getGL().getGL2ES2(); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java index b29d886c9..d6affd7e2 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java @@ -39,18 +39,15 @@ import javax.media.opengl.GLProfile; import javax.media.opengl.fixedfunc.GLMatrixFunc; import org.junit.Assert; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import com.jogamp.common.util.IOUtil; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.curve.opengl.TextRegionUtil; import com.jogamp.graph.font.Font; -import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.geom.SVertex; import com.jogamp.opengl.math.geom.AABBox; import com.jogamp.opengl.test.junit.util.NEWTGLContext; @@ -102,10 +99,14 @@ public class TestTextRendererNEWTBugXXXX extends UITestCase { } @Test - public void test00() throws InterruptedException, GLException, IOException { - testTextRendererImpl(FontSet01.getSet01(), Region.VBAA_RENDERING_BIT, 4); + public void test00All() throws InterruptedException, GLException, IOException { + testTextRendererImpl(FontSet01.getSet01(), Region.VBAA_RENDERING_BIT, 4, false); } - void testTextRendererImpl(final Font[] fonts, final int renderModes, final int sampleCount) throws InterruptedException, GLException, IOException { + @Test + public void test01OnlyIssues() throws InterruptedException, GLException, IOException { + testTextRendererImpl(FontSet01.getSet01(), Region.VBAA_RENDERING_BIT, 4, true); + } + void testTextRendererImpl(final Font[] fonts, final int renderModes, final int sampleCount, final boolean onlyIssues) throws InterruptedException, GLException, IOException { final GLProfile glp; if(forceGL3) { glp = GLProfile.get(GLProfile.GL3); @@ -121,12 +122,13 @@ public class TestTextRendererNEWTBugXXXX extends UITestCase { caps.setSampleBuffers(true); caps.setNumSamples(sampleCount); } + caps.setOnscreen(false); System.err.println("Requested: "+caps); System.err.println("Requested: "+Region.getRenderModeString(renderModes)); + final int totalHeight = ( (int)fontSize + 1 ) * ( onlyIssues ? 3 : 6 ) * fonts.length; final NEWTGLContext.WindowContext winctx = - // NEWTGLContext.createOnscreenWindow(caps, 800, 400, true); - NEWTGLContext.createOffscreenWindow(caps, 800, 200*fonts.length, true); + NEWTGLContext.createWindow(caps, 800, totalHeight, true); final GLDrawable drawable = winctx.context.getGLDrawable(); final GL2ES2 gl = winctx.context.getGL().getGL2ES2(); @@ -161,9 +163,9 @@ public class TestTextRendererNEWTBugXXXX extends UITestCase { renderString(drawable, gl, renderer, font, textRenderUtil, "012345678901234567890123456789", 0, -1, -1000, sampleCountIO); renderString(drawable, gl, renderer, font, textRenderUtil, "abcdefghijklmnopqrstuvwxyz", 0, -1, -1000, sampleCountIO); renderString(drawable, gl, renderer, font, textRenderUtil, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, -1, -1000, sampleCountIO); - renderString(drawable, gl, renderer, font, textRenderUtil, "", 0, -1, -1000, sampleCountIO); - renderString(drawable, gl, renderer, font, textRenderUtil, "", 0, -1, -1000, sampleCountIO); } + renderString(drawable, gl, renderer, font, textRenderUtil, "", 0, -1, -1000, sampleCountIO); + renderString(drawable, gl, renderer, font, textRenderUtil, "", 0, -1, -1000, sampleCountIO); } drawable.swapBuffers(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java index ba57c6dbd..9e38b0d50 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java @@ -73,7 +73,7 @@ public class TestFBOMRTNEWT01 extends UITestCase { System.err.println("Test requires GL2/GL3 profile."); return; } - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow( new GLCapabilities(GLProfile.getGL2GL3()), width/step, height/step, true); final GLDrawable drawable = winctx.context.getGLDrawable(); final GL2GL3 gl = winctx.context.getGL().getGL2GL3(); 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 1f9e6e877..aabd4821d 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 @@ -61,8 +61,10 @@ public class TestGPUMemSec01NEWT extends UITestCase { } static NEWTGLContext.WindowContext createCurrentGLOffscreenWindow(final GLProfile glp, final int width, final int height) throws GLException, InterruptedException { - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOffscreenWindow( - new GLCapabilities(glp), width, height, true); + final GLCapabilities caps = new GLCapabilities(glp); + caps.setOnscreen(false); + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow( + caps, width, height, true); final GL gl = winctx.context.getGL(); // System.err.println("Pre GL Error: 0x"+Integer.toHexString(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 d94c24af0..5ba0c7794 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 @@ -99,8 +99,10 @@ public class TestMapBufferRead01NEWT extends UITestCase { private void testWriteRead01(final ByteBuffer verticiesBB, final boolean useRange) throws InterruptedException { final GLProfile glp = GLProfile.getMaxProgrammable(true); - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOffscreenWindow( - new GLCapabilities(glp), 800, 600, true); + final GLCapabilities caps = new GLCapabilities(glp); + caps.setOnscreen(false); + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow( + caps, 800, 600, true); try { final GL gl = winctx.context.getGL(); 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 b3e01ac0f..57d6caa85 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 @@ -67,7 +67,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase { @Test public void test00NoShaderState_Validation() throws InterruptedException { // preset .. - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow( new GLCapabilities(GLProfile.getGL2ES2()), 480, 480, true); final GLDrawable drawable = winctx.context.getGLDrawable(); final GL2ES2 gl = winctx.context.getGL().getGL2ES2(); @@ -183,7 +183,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase { @Test public void test01ShaderState_Validation() throws InterruptedException { // preset .. - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow( new GLCapabilities(GLProfile.getGL2ES2()), 480, 480, true); final GLDrawable drawable = winctx.context.getGLDrawable(); final GL2ES2 gl = winctx.context.getGL().getGL2ES2(); @@ -306,7 +306,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase { private void testShaderState_PerformanceSingleImpl(final boolean toggleEnable) throws InterruptedException { // preset .. - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow( new GLCapabilities(GLProfile.getGL2ES2()), 480, 480, false); final GLDrawable drawable = winctx.context.getGLDrawable(); final GL2ES2 gl = winctx.context.getGL().getGL2ES2(); @@ -395,7 +395,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase { @Test(timeout=240000) public void test04ShaderState_PerformanceDouble() throws InterruptedException { // preset .. - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow( new GLCapabilities(GLProfile.getGL2ES2()), 480, 480, false); final GLDrawable drawable = winctx.context.getGLDrawable(); final GL2ES2 gl = winctx.context.getGL().getGL2ES2(); 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 21d945470..501850c4f 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 @@ -74,7 +74,7 @@ public class TestGLSLShaderState02NEWT extends UITestCase { private void testShaderState01Validation(final boolean linkSP1) throws InterruptedException { // preset .. - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow( new GLCapabilities(GLProfile.getGL2ES2()), 480, 480, true); final GLDrawable drawable = winctx.context.getGLDrawable(); final GL2ES2 gl = winctx.context.getGL().getGL2ES2(); @@ -240,7 +240,7 @@ public class TestGLSLShaderState02NEWT extends UITestCase { @Test(timeout=240000) public void testShaderState01PerformanceDouble() throws InterruptedException { // preset .. - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow( new GLCapabilities(GLProfile.getGL2ES2()), 480, 480, false); final GLDrawable drawable = winctx.context.getGLDrawable(); final GL2ES2 gl = winctx.context.getGL().getGL2ES2(); 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 71b2d488e..e267d93b1 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 @@ -88,7 +88,7 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase { final static String glps = GLProfile.GL3; private NEWTGLContext.WindowContext prepareTest() throws GLException, InterruptedException { - final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( + final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow( new GLCapabilities(GLProfile.getMaxProgrammable(true)), 480, 480, debugGL); if(!winctx.context.getGL().isGL3()) { System.err.println("GL3 not available"); 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 cd3a1eaa2..d897a51a1 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java +++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java @@ -53,45 +53,7 @@ public class NEWTGLContext { } } - public static WindowContext createOffscreenWindow(final GLCapabilities caps, final int width, final int height, final boolean debugGL) throws InterruptedException { - caps.setOnscreen(false); - caps.setPBuffer(true); - - // - // Create native windowing resources .. X11/Win/OSX - // - final Display display = NewtFactory.createDisplay(null); // local display - Assert.assertNotNull(display); - - final Screen screen = NewtFactory.createScreen(display, 0); // screen 0 - Assert.assertNotNull(screen); - - final Window window = NewtFactory.createWindow(screen, caps); - Assert.assertNotNull(window); - window.setSize(width, height); - window.setVisible(true); - Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true)); - Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true)); - - final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); - final GLDrawable drawable = factory.createGLDrawable(window); - Assert.assertNotNull(drawable); - - drawable.setRealized(true); - Assert.assertTrue(drawable.isRealized()); - - final GLContext context = drawable.createContext(null); - Assert.assertNotNull(context); - - context.enableGLDebugMessage(debugGL); - - final int res = context.makeCurrent(); - Assert.assertTrue(GLContext.CONTEXT_CURRENT_NEW==res || GLContext.CONTEXT_CURRENT==res); - - return new WindowContext(window, drawable, context); - } - - public static WindowContext createOnscreenWindow(final GLCapabilities caps, final int width, final int height, final boolean debugGL) throws InterruptedException { + public static WindowContext createWindow(final GLCapabilities caps, final int width, final int height, final boolean debugGL) throws InterruptedException { // // Create native windowing resources .. X11/Win/OSX // |