diff options
author | Sven Gothel <[email protected]> | 2023-03-08 07:15:16 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-08 07:15:16 +0100 |
commit | 10e74469da647d377967477d30a67ca5e36ed148 (patch) | |
tree | 76cef980c90c79b704be29b7c3cde8d056a64f8b /src | |
parent | bbaccf87a4f3ab10095017c1d375ed624979ec7b (diff) |
TestTextRendererNEWT20: Cover Graph-VBAA, Graph-MSAA, FSAA, NONE .. (have proper filenames for screenshots)
Diffstat (limited to 'src')
3 files changed, 76 insertions, 21 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT20.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT20.java index a044ce9d5..fbf9f8c50 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT20.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT20.java @@ -36,6 +36,7 @@ import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLCapabilitiesImmutable; import com.jogamp.opengl.GLException; import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.JoglVersion; import jogamp.common.os.PlatformPropsImpl; @@ -45,6 +46,7 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.VersionUtil; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.graph.font.Font; @@ -52,7 +54,9 @@ import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.geom.SVertex; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.test.junit.graph.demos.GPUTextRendererListenerBase01; +import com.jogamp.opengl.test.junit.graph.demos.MSAATool; import com.jogamp.opengl.test.junit.util.UITestCase; +import com.jogamp.opengl.util.caps.NonFSAAGLCapabilitiesChooser; /** @@ -109,6 +113,11 @@ public class TestTextRendererNEWT20 extends UITestCase { Assert.assertNotNull(caps); final GLWindow window = GLWindow.create(caps); + if( !caps.getSampleBuffers() ) { + // Make sure to not have FSAA if not requested + // TODO: Implement in default chooser? + window.setCapabilitiesChooser(new NonFSAAGLCapabilitiesChooser(true)); + } window.setSize(width, height); window.setPosition(10, 10); window.setTitle(title); @@ -119,7 +128,7 @@ public class TestTextRendererNEWT20 extends UITestCase { } @Test - public void testTextRendererR2T01() throws InterruptedException, GLException, IOException { + public void test00TextRendererVBAA01() throws InterruptedException, GLException, IOException { if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME // FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise). System.err.println("disabled on non desktop (x86) arch for now .."); @@ -131,8 +140,10 @@ public class TestTextRendererNEWT20 extends UITestCase { caps.setAlphaBits(4); System.err.println("Requested: "+caps); - final GLWindow window = createWindow("text-vbaa1-msaa0", caps, win_width, win_height); + final GLWindow window = createWindow("TTRN20", caps, win_width, win_height); window.display(); + System.err.println(VersionUtil.getPlatformInfo()); + // System.err.println(JoglVersion.getAllAvailableCapabilitiesInfo(window.getScreen().getDisplay().getGraphicsDevice(), null).toString()); System.err.println("Chosen: "+window.getChosenGLCapabilities()); final RenderState rs = RenderState.createRenderState(SVertex.factory()); @@ -147,20 +158,60 @@ public class TestTextRendererNEWT20 extends UITestCase { final Runnable action_per_font = new Runnable() { @Override public void run() { - if( false ) { - textGLListener.setHeadBox(1, false); - textGLListener.setSampleCount(2); - window.display(); - textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); - sleep(); - - textGLListener.setHeadBox(2, false); - textGLListener.setSampleCount(2); - window.display(); - textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); - sleep(); - } + textGLListener.setHeadBox(1, false); + textGLListener.setSampleCount(4); + window.display(); + textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); + sleep(); + + textGLListener.setHeadBox(2, false); + textGLListener.setSampleCount(4); + window.display(); + textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); + sleep(); + } }; + final Font[] fonts = FontSet01.getSet01(); + for(final Font f : fonts) { + if( textGLListener.setFont(f) ) { + action_per_font.run(); + } + } + if(textGLListener.setFontSet(FontFactory.JAVA, 0, 0)) { + action_per_font.run(); + } + destroyWindow(window); + } + + @Test + public void test10TextRendererMSAA01() throws InterruptedException, GLException, IOException { + if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME + // FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise). + System.err.println("disabled on non desktop (x86) arch for now .."); + return; + } + final GLProfile glp = GLProfile.getGL2ES2(); + + final GLCapabilities caps = new GLCapabilities(glp); + caps.setAlphaBits(4); + System.err.println("Requested: "+caps); + + final GLWindow window = createWindow("TTRN20", caps, win_width, win_height); + window.display(); + System.err.println("Chosen: "+window.getChosenGLCapabilities()); + + final RenderState rs = RenderState.createRenderState(SVertex.factory()); + final TextGLListener textGLListener = new TextGLListener(glp, rs, Region.MSAA_RENDERING_BIT, 4 /* sampleCount */, DEBUG, TRACE); + textGLListener.attachInputListenerTo(window); + window.addGLEventListener(textGLListener); + textGLListener.setHeadBox(2, true); + window.display(); + // final AABBox headbox = textGLListener.getHeadBox(); + // GPUTextRendererListenerBase01.upsizeWindowSurface(window, false, (int)(headbox.getWidth()*1.5f), (int)(headbox.getHeight()*2f)); + + final Runnable action_per_font = new Runnable() { + @Override + public void run() { textGLListener.setHeadBox(1, false); textGLListener.setSampleCount(4); window.display(); @@ -187,7 +238,7 @@ public class TestTextRendererNEWT20 extends UITestCase { } @Test - public void testTextRendererMSAA01() throws InterruptedException, GLException, IOException { + public void test20TextRendererFSAA01() throws InterruptedException, GLException, IOException { final GLProfile glp = GLProfile.get(GLProfile.GL2ES2); final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); @@ -195,7 +246,7 @@ public class TestTextRendererNEWT20 extends UITestCase { caps.setNumSamples(4); System.err.println("Requested: "+caps); - final GLWindow window = createWindow("text-vbaa0-msaa1", caps, 1024, 640); + final GLWindow window = createWindow("TTRN20", caps, 1024, 640); window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); @@ -236,13 +287,13 @@ public class TestTextRendererNEWT20 extends UITestCase { } @Test - public void testTextRendererNoSampling() throws InterruptedException, GLException, IOException { + public void test30TextRendererNoSampling() throws InterruptedException, GLException, IOException { final GLProfile glp = GLProfile.get(GLProfile.GL2ES2); final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); System.err.println("Requested: "+caps); - final GLWindow window = createWindow("text-vbaa0-msaa0", caps, 1024, 640); + final GLWindow window = createWindow("TTRN20", caps, 1024, 640); window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); @@ -303,6 +354,8 @@ public class TestTextRendererNEWT20 extends UITestCase { final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.setSwapInterval(1); gl.glEnable(GL.GL_DEPTH_TEST); + System.err.println(JoglVersion.getGLInfo(gl, null, false /* withCapsAndExts */).toString()); + MSAATool.dump(drawable); final RenderState rs = getRenderer().getRenderState(); rs.setColorStatic(0.1f, 0.1f, 0.1f, 1.0f); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java index 47205a14a..6131ca6fd 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java @@ -242,7 +242,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { } public void printScreen(final GLAutoDrawable drawable, final String dir, final String tech, final String objName, final boolean exportAlpha) throws GLException, IOException { - final String sw = String.format("-%s-S%02d-Z%04d-snap%02d-%03dx%03d", objName, sampleCount[0], (int)Math.abs(zTran), screenshot_num++, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); + final String sw = String.format("_s%02d-%s-Z%04d-snap%02d-%03dx%03d", sampleCount[0], objName, (int)Math.abs(zTran), screenshot_num++, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); final String filename = dir + tech + sw +".png"; if(screenshot.readPixels(drawable.getGL(), false)) { screenshot.write(new File(filename)); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java index 78d893cf2..d18766ee1 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java @@ -521,7 +521,9 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB @Override public void printScreen(final GLAutoDrawable drawable, final String dir, final String tech, final String objName, final boolean exportAlpha) throws GLException, IOException { final String fn = font.getFullFamilyName().replace(' ', '_').replace('-', '_'); - super.printScreen(drawable, dir, tech+"-"+fn, "text"+getHeadBoxType()+"-"+objName, exportAlpha); + final String modes = Region.getRenderModeString(getRenderModes()); + final String fsaa = "fsaa"+drawable.getChosenGLCapabilities().getNumSamples(); + super.printScreen(drawable, dir, tech+"-"+modes, fsaa+"-"+fn+"-text"+getHeadBoxType()+"-"+objName, exportAlpha); } float fontHeadScale = 1f; |