diff options
Diffstat (limited to 'src/test/com')
12 files changed, 125 insertions, 119 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/FontViewListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/FontViewListener01.java index 6c3bd692a..11343b4ee 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/FontViewListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/FontViewListener01.java @@ -1,5 +1,5 @@ /** - * Copyright 2023 JogAmp Community. All rights reserved. + * Copyright 2023-2024 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: @@ -27,6 +27,7 @@ */ package com.jogamp.opengl.test.junit.graph; +import com.jogamp.graph.curve.Region; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontScale; import com.jogamp.graph.ui.Group; @@ -54,13 +55,15 @@ public class FontViewListener01 implements GLEventListener { private boolean useDPI = false; private final int renderModes; + private final int graphAAQuality; private final char startCharSymbol; private final Font font; private final Scene scene; private Group grid; - public FontViewListener01(final int renderModes, final int graphSampleCount, final Font font, final char startCharSymbol) { + public FontViewListener01(final int renderModes, final int graphAAQuality, final int graphSampleCount, final Font font, final char startCharSymbol) { this.renderModes = renderModes; + this.graphAAQuality = Region.clipAAQuality(graphAAQuality); this.startCharSymbol = startCharSymbol; this.font = font; @@ -136,6 +139,7 @@ public class FontViewListener01 implements GLEventListener { grid = new Group(new GridLayout(gridCols, netGridSize, netGridSize, Alignment.FillCenter, new Gap(netGridSize/0.90f*0.10f))); scene.addShape(grid); + scene.setAAQuality(graphAAQuality); for(int idx=0; idx<Character.MAX_VALUE && grid.getShapeCount() < cellCount ; ++idx) { final char codepoint = (char)(startCharSymbol+idx); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java index 4c8d98611..eba3ecec6 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java @@ -52,15 +52,16 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 { final int shape_ctor_mode; OutlineShape outlineShape = null; - public GPURegionGLListener01 (final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { - this(1, renderModes, sampleCount, debug, trace); + public GPURegionGLListener01 (final int renderModes, final int aaQuality, final int sampleCount, final boolean debug, final boolean trace) { + this(1, renderModes, aaQuality, sampleCount, debug, trace); } - public GPURegionGLListener01 (final int shape_ctor_mode, final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { + public GPURegionGLListener01 (final int shape_ctor_mode, final int renderModes, final int aaQuality, final int sampleCount, final boolean debug, final boolean trace) { super(RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); this.shape_ctor_mode = shape_ctor_mode; this.getRenderer().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); setMatrix(-20, 00, -50, 0f, sampleCount); + setAAQuality(aaQuality); } private void createTestOutline00(){ @@ -290,7 +291,7 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 { regionRenderer.setWeight(weight); } regionRenderer.enable(gl, true); - region.draw(gl, regionRenderer, Region.MAX_AA_QUALITY, getSampleCount()); + region.draw(gl, regionRenderer, getAAQuality(), getSampleCount()); regionRenderer.enable(gl, false); } } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java b/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java index d256424e5..dc2fa4df0 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java @@ -50,10 +50,11 @@ import com.jogamp.graph.curve.opengl.RegionRenderer; public class GPURegionGLListener10 extends GPURendererListenerBase01 { List<OutlineShape> outlineShapes = new ArrayList<OutlineShape>(); - public GPURegionGLListener10 (final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { + public GPURegionGLListener10 (final int renderModes, final int aaQuality, final int sampleCount, final boolean debug, final boolean trace) { super(RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); this.getRenderer().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); setMatrix(-20, 00, -50, 0f, sampleCount); + setAAQuality(aaQuality); } private void createTestOutline(final GLProfile glp){ @@ -130,7 +131,7 @@ public class GPURegionGLListener10 extends GPURendererListenerBase01 { regionRenderer.setWeight(weight); } regionRenderer.enable(gl, true); - region.draw(gl, regionRenderer, Region.MAX_AA_QUALITY, getSampleCount()); + region.draw(gl, regionRenderer, getAAQuality(), getSampleCount()); regionRenderer.enable(gl, false); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/GPURendererListenerBase01.java index 2eac05555..48f8d8a65 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/GPURendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/GPURendererListenerBase01.java @@ -1,5 +1,5 @@ /** - * Copyright 2010 JogAmp Community. All rights reserved. + * Copyright 2010-2024 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: @@ -90,6 +90,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { private float yTran = 10; private float ang = 0f; private float zTran = -70f; + private int graphAAQuality = Region.DEFAULT_AA_QUALITY; private final int[] sampleCount = new int[] { 4 }; protected volatile float weight = 1.0f; @@ -114,12 +115,15 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { public final int[] getSampleCount() { return sampleCount; } public final float[] getPosition() { return position; } + public final void setAAQuality(final int v) { graphAAQuality = Region.clipAAQuality(v); } + public final int getAAQuality() { return graphAAQuality; } + public void setMatrix(final float xtrans, final float ytrans, final float zTran, final float angle, final int sampleCount) { this.xTran = xtrans; this.yTran = ytrans; this.zTran = zTran; this.ang = angle; - this.sampleCount[0] = sampleCount; + this.sampleCount[0] = Region.clipAASampleCount(sampleCount); } @Override @@ -239,7 +243,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%02d-%s-Z%04d-snap%02d-%03dx%03d", sampleCount[0], objName, (int)Math.abs(zTran), screenshot_num++, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); + final String sw = String.format("_q%01d_s%02d-%s-Z%04d-snap%02d-%03dx%03d", graphAAQuality, 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/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/GPUTextRendererListenerBase01.java index 32db14340..c3bff3408 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/GPUTextRendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/GPUTextRendererListenerBase01.java @@ -1,5 +1,5 @@ /** - * Copyright 2010-2023 JogAmp Community. All rights reserved. + * Copyright 2010-2024 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: @@ -148,7 +148,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB Window upstream_window = null; StringBuilder userString = new StringBuilder(textX1); boolean userInput = false; - public GPUTextRendererListenerBase01(final GLProfile glp, final int renderModes, final int sampleCount, final boolean blending, final boolean debug, final boolean trace) { + public GPUTextRendererListenerBase01(final GLProfile glp, final int renderModes, final int aaQuality, final int sampleCount, final boolean blending, final boolean debug, final boolean trace) { // NOTE_ALPHA_BLENDING: We use alpha-blending super(RegionRenderer.create(blending ? RegionRenderer.defaultBlendEnable : null, blending ? RegionRenderer.defaultBlendDisable : null), renderModes, debug, trace); @@ -159,6 +159,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB this.regionBottom = GLRegion.create(glp, renderModes, null, 0, 0); setFontSet(fontSet, FontSet.FAMILY_LIGHT, FontSet.STYLE_NONE); setMatrix(0, 0, 0, 0f, sampleCount); + setAAQuality(aaQuality); } void switchHeadBox() { @@ -323,7 +324,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB lfps = 0f; tfps = 0f; } - final String modeS = Region.getRenderModeString(regionFPS.getRenderModes()); + final String modeS = Region.getRenderModeString(regionFPS.getRenderModes())+"-q"+getAAQuality(); final String text = String.format("%03.1f/%03.1f fps, v-sync %d, dpiV %.2f %.2f px/mm, font[head %.1fpt %.2fpx %.2fmm, center %.1fpt %.2fpx %.2fmm], %s-samples[%d, this %d], blend %b, alpha %d", lfps, tfps, gl.getSwapInterval(), dpiV, ppmmV, fontSizeHead, pixelSizeHead, mmSizeHead, @@ -339,7 +340,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB pmv.scaleMv(sxy, sxy, 1.0f); } // No cache, keep region alive! - TextRegionUtil.drawString3D(gl, regionFPS.clear(gl), renderer, font, text, null, sampleCountFPS, tempT1, tempT2); + TextRegionUtil.drawString3D(gl, regionFPS.clear(gl), renderer, font, text, null, getAAQuality(), sampleCountFPS, tempT1, tempT2); pmv.popMv(); } @@ -354,7 +355,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB pmv.scaleMv(sxy, sxy, 1.0f); } // System.err.printf("FontN: [%f %f] -> [%f %f]%n", dx, dy, nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy)); - textRegionUtil.drawString3D(gl, renderer, font, fontName, null, getSampleCount()); + textRegionUtil.drawString3D(gl, renderer, font, fontName, null, getAAQuality(), getSampleCount()); pmv.popMv(); } @@ -370,7 +371,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB pmv.scaleMv(sxy, sxy, 1.0f); } // pmv.glTranslatef(x0, y1, z0); - textRegionUtil.drawString3D(gl, renderer, font, headtext, null, getSampleCount()); + textRegionUtil.drawString3D(gl, renderer, font, headtext, null, getAAQuality(), getSampleCount()); pmv.popMv(); } @@ -393,15 +394,15 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB } if(!userInput) { if( bottomTextUseFrustum ) { - TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, text2, null, getSampleCount(), tempT1, tempT2); + TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, text2, null, getAAQuality(), getSampleCount(), tempT1, tempT2); } else { - textRegionUtil.drawString3D(gl, renderer, font, text2, null, getSampleCount()); + textRegionUtil.drawString3D(gl, renderer, font, text2, null, getAAQuality(), getSampleCount()); } } else { if( bottomTextUseFrustum ) { - TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, userString.toString(), null, getSampleCount(), tempT1, tempT2); + TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, userString.toString(), null, getAAQuality(), getSampleCount(), tempT1, tempT2); } else { - textRegionUtil.drawString3D(gl, renderer, font, userString.toString(), null, getSampleCount()); + textRegionUtil.drawString3D(gl, renderer, font, userString.toString(), null, getAAQuality(), getSampleCount()); } } pmv.popMv(); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/PerfTextRendererNEWT00.java b/src/test/com/jogamp/opengl/test/junit/graph/PerfTextRendererNEWT00.java index b2adf26c3..4f2161c7d 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/PerfTextRendererNEWT00.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/PerfTextRendererNEWT00.java @@ -308,7 +308,7 @@ public class PerfTextRendererNEWT00 { pmv.loadMvIdentity(); pmv.translateMv(dx, dy, z0); pmv.scaleMv(fontScale, fontScale, 1f); - region.draw(gl, renderer, Region.MAX_AA_QUALITY, sampleCountIO); + region.draw(gl, renderer, Region.DEFAULT_AA_QUALITY, sampleCountIO); final long t5 = Clock.currentNanos(); // text added to region if( null != perf ) { final long td_graph = t3 - t2; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java index c19cec993..8d7fdb852 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java @@ -1,5 +1,5 @@ /** - * Copyright 2011-2023 JogAmp Community. All rights reserved. + * Copyright 2011-2024 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: @@ -85,7 +85,7 @@ public class TestRegionRendererNEWT01 extends UITestCase { final GLWindow window = createWindow("t00-shape-vbaa0-msaa0", caps, 800, 400); - final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (0, 0, false, false); + final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (0, Region.DEFAULT_AA_QUALITY, 0, false, false); demo01Listener.attachInputListenerTo(window); window.addGLEventListener(demo01Listener); @@ -118,7 +118,7 @@ public class TestRegionRendererNEWT01 extends UITestCase { final GLWindow window = createWindow("t01-shape-vbaa0-msaa0", caps, 800, 400); - final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.VARWEIGHT_RENDERING_BIT, 0, false, false); + final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.VARWEIGHT_RENDERING_BIT, Region.DEFAULT_AA_QUALITY, 0, false, false); demo01Listener.attachInputListenerTo(window); window.addGLEventListener(demo01Listener); @@ -148,7 +148,7 @@ public class TestRegionRendererNEWT01 extends UITestCase { final GLWindow window = createWindow("t10-shape-vbaa0-msaa1", caps, 800, 400); - final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (0, 0, false, false); + final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (0, Region.DEFAULT_AA_QUALITY, 0, false, false); demo01Listener.attachInputListenerTo(window); window.addGLEventListener(demo01Listener); @@ -183,7 +183,7 @@ public class TestRegionRendererNEWT01 extends UITestCase { final GLWindow window = createWindow("t11-shape-vbaa0-msaa1", caps, 800, 400); - final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.VARWEIGHT_RENDERING_BIT, 0, false, false); + final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.VARWEIGHT_RENDERING_BIT, Region.DEFAULT_AA_QUALITY, 0, false, false); demo01Listener.attachInputListenerTo(window); window.addGLEventListener(demo01Listener); @@ -216,7 +216,7 @@ public class TestRegionRendererNEWT01 extends UITestCase { caps.setAlphaBits(4); final GLWindow window = createWindow("t20-shape-vbaa1-msaa0", caps, 800,400); - final GPURegionGLListener10 demo02Listener = new GPURegionGLListener10 (Region.VBAA_RENDERING_BIT, 4, false, false); + final GPURegionGLListener10 demo02Listener = new GPURegionGLListener10 (Region.VBAA_RENDERING_BIT, Region.DEFAULT_AA_QUALITY, 4, false, false); demo02Listener.attachInputListenerTo(window); window.addGLEventListener(demo02Listener); @@ -238,7 +238,7 @@ public class TestRegionRendererNEWT01 extends UITestCase { private void test30RegionRendererShapesImpl(final GLCapabilities caps, final int shape_ctor_mode) throws InterruptedException { final GLWindow window = createWindow("t30-shape0"+shape_ctor_mode+"-vbaa0-msaa1", caps, 800, 400); - final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (shape_ctor_mode, 0, 0, false, false); + final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (shape_ctor_mode, 0, Region.DEFAULT_AA_QUALITY, 0, false, false); demo01Listener.attachInputListenerTo(window); window.addGLEventListener(demo01Listener); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java index 9572b5d6f..3a2aa47a2 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java @@ -1,5 +1,5 @@ /** - * Copyright 2011-2023 JogAmp Community. All rights reserved. + * Copyright 2011-2024 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: @@ -256,7 +256,7 @@ public class TestTextRendererNEWT01 extends UITestCase { pmv.loadMvIdentity(); pmv.translateMv(dx, dy, z0); pmv.scaleMv(fontSize, fontSize, 1.0f); - textRenderUtil.drawString3D(gl, renderer, font, text, null, sampleCount); + textRenderUtil.drawString3D(gl, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, sampleCount); lastRow = row; } 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 5ce4005a6..24fcbb70f 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT20.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT20.java @@ -1,5 +1,5 @@ /** - * Copyright 2011-2023 JogAmp Community. All rights reserved. + * Copyright 2011-2024 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: @@ -27,6 +27,7 @@ */ package com.jogamp.opengl.test.junit.graph; +import java.io.File; import java.io.IOException; import com.jogamp.opengl.GL; @@ -69,6 +70,9 @@ public class TestTextRendererNEWT20 extends UITestCase { static long duration = 100; // ms static int win_width = 1024; static int win_height = 640; + static Font[] fontSet = new Font[] { }; + static int[] aaQualitySet = new int[] { 0, 1 }; + static int[] sampleSet = new int[] { 1, 2, 4 }; static int atoi(final String a) { try { @@ -87,8 +91,20 @@ public class TestTextRendererNEWT20 extends UITestCase { } else if(args[i].equals("-height")) { i++; win_height = atoi(args[i]); + } else if(args[i].equals("-font")) { + i++; + fontSet = new Font[] { FontFactory.get(new File(args[i])) }; + } else if(args[i].equals("-samples")) { + i++; + sampleSet = new int[] { atoi(args[i]) }; + } else if(args[i].equals("-aaq")) { + i++; + aaQualitySet = new int[] { atoi(args[i]) }; } } + if( 0 == fontSet.length ) { + fontSet = FontSet01.getSet01(); + } final String tstname = TestTextRendererNEWT20.class.getName(); org.junit.runner.JUnitCore.main(tstname); } @@ -143,7 +159,7 @@ public class TestTextRendererNEWT20 extends UITestCase { // System.err.println(JoglVersion.getAllAvailableCapabilitiesInfo(window.getScreen().getDisplay().getGraphicsDevice(), null).toString()); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - final TextGLListener textGLListener = new TextGLListener(glp, Region.VBAA_RENDERING_BIT, 4 /* sampleCount */, DEBUG, TRACE); + final TextGLListener textGLListener = new TextGLListener(glp, Region.VBAA_RENDERING_BIT, Region.DEFAULT_AA_QUALITY, 4 /* sampleCount */, DEBUG, TRACE); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); textGLListener.setHeadBox(2, true); @@ -155,22 +171,25 @@ public class TestTextRendererNEWT20 extends UITestCase { @Override public void run() { 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) { + for(final Font f : fontSet) { if( textGLListener.setFont(f) ) { - action_per_font.run(); + for(final int aaQuality : aaQualitySet ) { + textGLListener.setAAQuality(aaQuality); + for(final int sampleCount : sampleSet ) { + textGLListener.setSampleCount(sampleCount); + action_per_font.run(); + } + } } } if(textGLListener.setFontSet(FontFactory.JAVA, 0, 0)) { @@ -196,7 +215,7 @@ public class TestTextRendererNEWT20 extends UITestCase { window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - final TextGLListener textGLListener = new TextGLListener(glp, Region.MSAA_RENDERING_BIT, 4 /* sampleCount */, DEBUG, TRACE); + final TextGLListener textGLListener = new TextGLListener(glp, Region.MSAA_RENDERING_BIT, -1, 4 /* sampleCount */, DEBUG, TRACE); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); textGLListener.setHeadBox(2, true); @@ -208,22 +227,22 @@ public class TestTextRendererNEWT20 extends UITestCase { @Override public void run() { 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) { + for(final Font f : fontSet) { if( textGLListener.setFont(f) ) { - action_per_font.run(); + for(final int sampleCount : sampleSet ) { + textGLListener.setSampleCount(sampleCount); + action_per_font.run(); + } } } if(textGLListener.setFontSet(FontFactory.JAVA, 0, 0)) { @@ -245,7 +264,7 @@ public class TestTextRendererNEWT20 extends UITestCase { window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - final TextGLListener textGLListener = new TextGLListener(glp, 0, 0 /* sampleCount */, DEBUG, TRACE); + final TextGLListener textGLListener = new TextGLListener(glp, Region.NORM_RENDERING_BIT, -1, 0 /* sampleCount */, DEBUG, TRACE); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); textGLListener.setHeadBox(2, true); @@ -255,28 +274,21 @@ public class TestTextRendererNEWT20 extends UITestCase { @Override public void run() { textGLListener.setHeadBox(1, false); - textGLListener.setSampleCount(0); window.display(); textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); sleep(); textGLListener.setHeadBox(2, false); - textGLListener.setSampleCount(0); window.display(); textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); sleep(); } }; - final Font[] fonts = FontSet01.getSet01(); - for(final Font f : fonts) { + for(final Font f : fontSet) { if( textGLListener.setFont(f) ) { action_per_font.run(); } } - if(textGLListener.setFontSet(FontFactory.JAVA, 0, 0)) { - action_per_font.run(); - } - destroyWindow(window); } @@ -291,7 +303,7 @@ public class TestTextRendererNEWT20 extends UITestCase { window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - final TextGLListener textGLListener = new TextGLListener(glp, 0, 0 /* sampleCount */, DEBUG, TRACE); + final TextGLListener textGLListener = new TextGLListener(glp, Region.NORM_RENDERING_BIT, -1, 0 /* sampleCount */, DEBUG, TRACE); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); textGLListener.setHeadBox(2, true); @@ -301,34 +313,27 @@ public class TestTextRendererNEWT20 extends UITestCase { @Override public void run() { textGLListener.setHeadBox(1, false); - textGLListener.setSampleCount(0); window.display(); textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); sleep(); textGLListener.setHeadBox(2, false); - textGLListener.setSampleCount(0); window.display(); textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false); sleep(); } }; - final Font[] fonts = FontSet01.getSet01(); - for(final Font f : fonts) { + for(final Font f : fontSet) { if( textGLListener.setFont(f) ) { action_per_font.run(); } } - if(textGLListener.setFontSet(FontFactory.JAVA, 0, 0)) { - action_per_font.run(); - } - destroyWindow(window); } private static class TextGLListener extends GPUTextRendererListenerBase01 { - public TextGLListener(final GLProfile glp, final int type, final int sampleCount, final boolean debug, final boolean trace) { - super(glp, type, sampleCount, true, debug, trace); + public TextGLListener(final GLProfile glp, final int type, final int aaQuality, final int sampleCount, final boolean debug, final boolean trace) { + super(glp, type, aaQuality, sampleCount, true, debug, trace); } @Override diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT21.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT21.java index a3d88e1ba..6a1e92baf 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT21.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT21.java @@ -1,5 +1,5 @@ /** - * Copyright 2023 JogAmp Community. All rights reserved. + * Copyright 2023-2024 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: @@ -27,16 +27,13 @@ */ package com.jogamp.opengl.test.junit.graph; +import java.io.File; import java.io.IOException; -import com.jogamp.opengl.GL; -import com.jogamp.opengl.GL2ES2; -import com.jogamp.opengl.GLAutoDrawable; 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; @@ -48,7 +45,6 @@ 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; import com.jogamp.graph.font.FontFactory; import com.jogamp.newt.opengl.GLWindow; @@ -69,6 +65,9 @@ public class TestTextRendererNEWT21 extends UITestCase { static long duration = 100; // ms static int win_width = 1280; static int win_height = 720; + static Font[] fontSet = new Font[] { }; + static int[] aaQualitySet = new int[] { 0, 1 }; + static int[] sampleSet = new int[] { 1, 2, 4 }; static boolean onlyOne = false; static int atoi(final String a) { @@ -90,8 +89,20 @@ public class TestTextRendererNEWT21 extends UITestCase { } else if(args[i].equals("-height")) { i++; win_height = atoi(args[i]); + } else if(args[i].equals("-font")) { + i++; + fontSet = new Font[] { FontFactory.get(new File(args[i])) }; + } else if(args[i].equals("-samples")) { + i++; + sampleSet = new int[] { atoi(args[i]) }; + } else if(args[i].equals("-aaq")) { + i++; + aaQualitySet = new int[] { atoi(args[i]) }; } } + if( 0 == fontSet.length ) { + fontSet = FontSet01.getSet01(); + } final String tstname = TestTextRendererNEWT21.class.getName(); org.junit.runner.JUnitCore.main(tstname); } @@ -130,13 +141,15 @@ public class TestTextRendererNEWT21 extends UITestCase { class TestAction implements Runnable { private final GLWindow window; private final int renderModes; + private final int graphAAQuality; private final int graphSampleCount; private final Font font; private boolean keepAlive = false; - public TestAction(final GLWindow window, final int renderModes, final int graphSampleCount, final Font font) { + public TestAction(final GLWindow window, final int renderModes, final int graphAAQuality, final int graphSampleCount, final Font font) { this.window = window; this.renderModes = renderModes; + this.graphAAQuality = graphAAQuality; this.graphSampleCount = graphSampleCount; this.font = font; } @@ -147,9 +160,9 @@ public class TestTextRendererNEWT21 extends UITestCase { final int fsaaSampleCount = window.getChosenGLCapabilities().getNumSamples(); if( null != font ) { System.err.printf("Test Run: %s, %s%n", - Region.getRenderModeString(renderModes, graphSampleCount, fsaaSampleCount), + Region.getRenderModeString(renderModes, 0, graphSampleCount, fsaaSampleCount), font.getFullFamilyName()); - final FontViewListener01 glel = new FontViewListener01(renderModes, graphSampleCount, font, '!' /* startCharSymbol */); + final FontViewListener01 glel = new FontViewListener01(renderModes, graphAAQuality, graphSampleCount, font, '!' /* startCharSymbol */); glel.attachInputListenerTo(window); window.addGLEventListener(glel); window.display(); @@ -160,7 +173,7 @@ public class TestTextRendererNEWT21 extends UITestCase { } } else { System.err.printf("Test Skipped: %s, %s, font not available%n", - Region.getRenderModeString(renderModes, graphSampleCount, fsaaSampleCount), + Region.getRenderModeString(renderModes, 0, graphSampleCount, fsaaSampleCount), font.getFullFamilyName()); } } @@ -184,8 +197,7 @@ public class TestTextRendererNEWT21 extends UITestCase { // System.err.println(JoglVersion.getAllAvailableCapabilitiesInfo(window.getScreen().getDisplay().getGraphicsDevice(), null).toString()); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - final int graphSampleCount = 4; - final TestAction ta = new TestAction(window, Region.VBAA_RENDERING_BIT, graphSampleCount, FontSet01.getSet01()[0]); + final TestAction ta = new TestAction(window, Region.VBAA_RENDERING_BIT, aaQualitySet[0], sampleSet[0], fontSet[0]); ta.setKeepAlive(true); ta.run(); } @@ -209,15 +221,12 @@ public class TestTextRendererNEWT21 extends UITestCase { // System.err.println(JoglVersion.getAllAvailableCapabilitiesInfo(window.getScreen().getDisplay().getGraphicsDevice(), null).toString()); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - final int graphSampleCount = 4; - final Font[] fonts = FontSet01.getSet01(); - for(final Font f : fonts) { - new TestAction(window, Region.VBAA_RENDERING_BIT, graphSampleCount, f).run(); - } - try { - new TestAction(window, Region.VBAA_RENDERING_BIT, graphSampleCount, FontFactory.get(FontFactory.JAVA).get(0 /* family */, 0 /* stylebits */)).run(); - } catch(final IOException ioe) { - System.err.println("Caught: "+ioe.getMessage()); + for(final Font f : fontSet) { + for(final int aaQuality : aaQualitySet ) { + for(final int sampleCount : sampleSet ) { + new TestAction(window, Region.VBAA_RENDERING_BIT, aaQuality, sampleCount, f).run(); + } + } } destroyWindow(window); } @@ -239,15 +248,10 @@ public class TestTextRendererNEWT21 extends UITestCase { window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - final int graphSampleCount = 4; - final Font[] fonts = FontSet01.getSet01(); - for(final Font f : fonts) { - new TestAction(window, Region.MSAA_RENDERING_BIT, graphSampleCount, f).run(); - } - try { - new TestAction(window, Region.MSAA_RENDERING_BIT, graphSampleCount, FontFactory.get(FontFactory.JAVA).get(0 /* family */, 0 /* stylebits */)).run(); - } catch(final IOException ioe) { - System.err.println("Caught: "+ioe.getMessage()); + for(final Font f : fontSet) { + for(final int sampleCount : sampleSet ) { + new TestAction(window, Region.MSAA_RENDERING_BIT, -1, sampleCount, f).run(); + } } destroyWindow(window); } @@ -268,15 +272,8 @@ public class TestTextRendererNEWT21 extends UITestCase { window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - final int graphSampleCount = 0; - final Font[] fonts = FontSet01.getSet01(); - for(final Font f : fonts) { - new TestAction(window, Region.NORM_RENDERING_BIT, graphSampleCount, f).run(); - } - try { - new TestAction(window, Region.NORM_RENDERING_BIT, graphSampleCount, FontFactory.get(FontFactory.JAVA).get(0 /* family */, 0 /* stylebits */)).run(); - } catch(final IOException ioe) { - System.err.println("Caught: "+ioe.getMessage()); + for(final Font f : fontSet) { + new TestAction(window, Region.NORM_RENDERING_BIT, -1, 0, f).run(); } destroyWindow(window); } @@ -295,15 +292,8 @@ public class TestTextRendererNEWT21 extends UITestCase { window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - final int graphSampleCount = 0; - final Font[] fonts = FontSet01.getSet01(); - for(final Font f : fonts) { - new TestAction(window, Region.NORM_RENDERING_BIT, graphSampleCount, f).run(); - } - try { - new TestAction(window, Region.NORM_RENDERING_BIT, graphSampleCount, FontFactory.get(FontFactory.JAVA).get(0 /* family */, 0 /* stylebits */)).run(); - } catch(final IOException ioe) { - System.err.println("Caught: "+ioe.getMessage()); + for(final Font f : fontSet) { + new TestAction(window, Region.NORM_RENDERING_BIT, -1, 0, f).run(); } destroyWindow(window); } 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 79d50b43e..b5b8b1820 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java @@ -1,5 +1,5 @@ /** - * Copyright 2012-2023 JogAmp Community. All rights reserved. + * Copyright 2012-2024 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: @@ -201,7 +201,7 @@ public class TestTextRendererNEWTBugXXXX extends UITestCase { final float sxy = fontSize / font.getMetrics().getUnitsPerEM(); pmv.scaleMv(sxy, sxy, 1.0f); } - textRenderUtil.drawString3D(gl, renderer, font, text, null, sampleCount); + textRenderUtil.drawString3D(gl, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, sampleCount); lastRow = row; } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java index 8b1964388..73dfb716c 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java @@ -1,5 +1,5 @@ /** - * Copyright 2014 JogAmp Community. All rights reserved. + * Copyright 2014-2024 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: @@ -32,7 +32,7 @@ import java.io.IOException; import com.jogamp.opengl.GL2ES2; import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.GLEventListener; - +import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.graph.curve.opengl.RegionRenderer; @@ -258,11 +258,11 @@ public abstract class TextRendererGLELBase implements GLEventListener { } renderer.enable(gl, true); if( cacheRegion ) { - textRenderUtil.drawString3D(gl, renderer, font, text, null, vbaaSampleCount); + textRenderUtil.drawString3D(gl, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, vbaaSampleCount); } else if( null != region ) { - TextRegionUtil.drawString3D(gl, region, renderer, font, text, null, vbaaSampleCount, tempT1, tempT2); + TextRegionUtil.drawString3D(gl, region, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, vbaaSampleCount, tempT1, tempT2); } else { - TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, null, vbaaSampleCount, tempT1, tempT2); + TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, vbaaSampleCount, tempT1, tempT2); } renderer.enable(gl, false); |