diff options
author | Sven Göthel <[email protected]> | 2024-01-15 04:47:34 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-01-15 04:47:34 +0100 |
commit | d7cb4a77b71cb3703ff7ac0667c5a97f29a5bdb4 (patch) | |
tree | 17cb67b7867f0da11a2717492d691a5e96f52636 /src/demos/com/jogamp/opengl | |
parent | 9b8d1825cfb76454e42b196a93dc54d189a8a9a6 (diff) |
Graph/GraphUI AA-Quality (shader): Region: Add DEFAULT_AA_QUALITY and clipping funs for aaQuality/sampleCount; TextRegionUtil: Pass quality parameter in draw-functions
Region.DEFAULT_AA_QUALITY defaults to MAX_AA_QUALITY still
- TODO: AA shader is subject to change ..
Region.draw(..) clips the quality param (save)
TextRegionUtil: Pass quality parameter in draw-functions
- Allowing to select the AA shader
GraphUI Scene and some demos add the AA-quality param
to the status line or screenshot-filename.
- See Region.getRenderModeString(..)
+++
TestTextRendererNEWT20 and TestTextRendererNEWT21
now iterate through all fonts, AA-quality shader and sample-sizes.
Most demos and some more tests take AA-quality into acount,
demos via CommandlineOptions.graphAAQuality
Diffstat (limited to 'src/demos/com/jogamp/opengl')
21 files changed, 65 insertions, 39 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java index 0326ce075..9756f7413 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java @@ -32,7 +32,6 @@ import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2ES2; import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.GLProfile; -import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; @@ -40,7 +39,6 @@ import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.math.Vec4f; import com.jogamp.math.util.PMVMatrix4f; import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.opengl.util.PMVMatrix; /** Demonstrate the rendering of multiple outlines into one region/OutlineShape * These Outlines are not necessary connected or contained. @@ -52,10 +50,11 @@ import com.jogamp.opengl.util.PMVMatrix; public class GPURegionGLListener00 extends GPURendererListenerBase01 { OutlineShape outlineShape = null; - public GPURegionGLListener00 (final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { + public GPURegionGLListener00 (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){ @@ -127,7 +126,7 @@ public class GPURegionGLListener00 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/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java index 78aee8dd3..4361f30ef 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java @@ -55,14 +55,15 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 { OutlineShape outlineShape = null; public GPURegionGLListener01 (final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { - this(1, renderModes, sampleCount, debug, trace); + this(1, renderModes, Region.DEFAULT_AA_QUALITY, 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(){ @@ -292,7 +293,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/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java index b397e991e..c069c9346 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java @@ -52,10 +52,11 @@ import com.jogamp.opengl.util.PMVMatrix; 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){ @@ -132,7 +133,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/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java index 33a7be35a..908b776cc 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java @@ -130,7 +130,7 @@ public class GPURegionNewtDemo { window.setSize(width, height); window.setTitle("GPU Curve Region Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples); - final GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (shape_ctor_mode, rmode, sampleCount, DEBUG, TRACE); + final GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (shape_ctor_mode, rmode, Region.DEFAULT_AA_QUALITY, sampleCount, DEBUG, TRACE); regionGLListener.attachInputListenerTo(window); window.addGLEventListener(regionGLListener); window.setVisible(true); diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java b/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java index ebc8846e3..bbee3a419 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java @@ -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,6 +115,9 @@ 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; diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java b/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java index 1f6be695c..cc6880fcc 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java @@ -37,8 +37,8 @@ import com.jogamp.newt.opengl.GLWindow; public class GPUTextGLListener0A extends GPUTextRendererListenerBase01 { - public GPUTextGLListener0A(final GLProfile glp, final int renderModes, final int sampleCount, final boolean blending, final boolean debug, final boolean trace) { - super(glp, renderModes, sampleCount, blending, debug, trace); + public GPUTextGLListener0A(final GLProfile glp, final int renderModes, final int aaQuality, final int sampleCount, final boolean blending, final boolean debug, final boolean trace) { + super(glp, renderModes, aaQuality, sampleCount, blending, debug, trace); } @Override diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java b/src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java index 25eae1156..190c61a9a 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java @@ -140,7 +140,7 @@ public class GPUTextNewtDemo { window.setSize(width, height); window.setTitle("GPU Text Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples); - final GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(glp, rmode, sampleCount, true, DEBUG, TRACE); + final GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(glp, rmode, Region.DEFAULT_AA_QUALITY, sampleCount, true, DEBUG, TRACE); textGLListener.setFont(opt_font); textGLListener.setFontHeadSize(opt_fontSizeHead); // ((TextRenderer)textGLListener.getRenderer()).setCacheLimit(32); diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java b/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java index 16d8aa1db..52c50cc38 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java @@ -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/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java b/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java index 9bd403341..026b32b0b 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java +++ b/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java @@ -262,11 +262,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); @@ -310,7 +310,7 @@ public abstract class TextRendererGLELBase implements GLEventListener { pmvMatrix.scaleMv(sxy, sxy, 1.0f); } renderer.enable(gl, true); - region.draw(gl, renderer, Region.MAX_AA_QUALITY, vbaaSampleCount); + region.draw(gl, renderer, Region.DEFAULT_AA_QUALITY, vbaaSampleCount); renderer.enable(gl, false); if( !exclusivePMVMatrix ) { diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java index 913c8062d..01a4b1824 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.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: @@ -347,6 +347,7 @@ public class FontView01 { } } scene.addShape(mainGrid); + scene.setAAQuality(options.graphAAQuality); window.addKeyListener(new KeyAdapter() { @Override diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java index 6235c481b..636819aa5 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java @@ -211,6 +211,7 @@ public class UIGraphDemoU01a { shape = new CrossHair(options.renderModes, normWidgetSize, normWidgetSize, normWidgetSize/100f); // normalized: 1 is 100% surface size (width and/or height) shape.setTextureUnit(pass2TexUnit); shape.setColor(0, 0, 1, 1); + shape.setAAQuality(options.graphAAQuality); System.err.println("Init: Shape bounds "+shape.getBounds(drawable.getGLProfile())); System.err.println("Init: Shape "+shape); } @@ -335,7 +336,7 @@ public class UIGraphDemoU01a { final float txt_scale = full_width_s < full_height_s ? full_width_s * normWidgetSize : full_height_s * normWidgetSize; pmv.scaleMv(txt_scale, txt_scale, 1f); pmv.translateMv(-txt_box_em.getWidth(), 0f, 0f); - final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, textRegion.clear(gl), renderer, font, text, text_color, sampleCount, tempT1, tempT2); + final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, textRegion.clear(gl), renderer, font, text, text_color, options.graphAAQuality, sampleCount, tempT1, tempT2); if( onceAtDisplay ) { System.err.println("XXX: full_width: "+worldDim.x()+" / "+txt_box_em.getWidth()+" -> "+full_width_s); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java index 9ab65d3d7..f49294415 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.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: @@ -35,7 +35,7 @@ import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontSet; import com.jogamp.graph.ui.Scene; -import com.jogamp.graph.ui.Shape; +import com.jogamp.graph.ui.GraphShape; import com.jogamp.graph.ui.shapes.Button; import com.jogamp.math.Recti; import com.jogamp.math.geom.AABBox; @@ -73,13 +73,14 @@ public class UISceneDemo00 { final Font font = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_LIGHT, FontSet.STYLE_SERIF); System.err.println("Font: "+font.getFullFamilyName()); - final Shape shape = new Button(options.renderModes, font, "+", 0.10f, 0.10f/2.5f); // normalized: 1 is 100% surface size (width and/or height) + final GraphShape shape = new Button(options.renderModes, font, "+", 0.10f, 0.10f/2.5f); // normalized: 1 is 100% surface size (width and/or height) System.err.println("Shape bounds "+shape.getBounds(reqGLP)); final Scene scene = new Scene(options.graphAASamples); scene.setPMVMatrixSetup(new MyPMVMatrixSetup()); scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); scene.addShape(shape); + scene.setAAQuality(options.graphAAQuality); final Animator animator = new Animator(0 /* w/o AWT */); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java index 3aa2b6551..e57253dc5 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java @@ -84,6 +84,7 @@ public class UISceneDemo01 { scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); scene.setPMVMatrixSetup(new MyPMVMatrixSetup()); scene.addShape(shape); + scene.setAAQuality(options.graphAAQuality); final Animator animator = new Animator(0 /* w/o AWT */); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java index e723d48ba..a66f5af56 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java @@ -85,6 +85,7 @@ public class UISceneDemo01b { final Scene scene = new Scene(options.graphAASamples); scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); scene.addShape(shape); + scene.setAAQuality(options.graphAAQuality); final Animator animator = new Animator(0 /* w/o AWT */); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java index b6d785733..503c6ef85 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java @@ -101,6 +101,7 @@ public class UISceneDemo02 { scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); scene.addShape(destText); scene.addShape(movingGlyph); + scene.setAAQuality(options.graphAAQuality); final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(1*60, null); // System.err); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java index 055348d99..55f798aca 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java @@ -446,6 +446,7 @@ public class UISceneDemo03 { } return true; }); + scene.setAAQuality(options.graphAAQuality); final long t0_us = Clock.currentNanos() / 1000; // [us] while ( ( null == dynAnimSet[0] || dynAnimSet[0].isAnimationActive() || animGroup.getTickPaused() ) && window.isNativeValid() ) { diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java index bd8e3e402..65645caba 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java @@ -1012,6 +1012,8 @@ public class UISceneDemo20 implements GLEventListener { initLabels(gl); initButtons(gl); + scene.setAAQuality(options.graphAAQuality); + scene.init(drawable); final GLAnimatorControl a = drawable.getAnimator(); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo00.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo00.java index aaef802f6..a9c3ca13f 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo00.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo00.java @@ -78,6 +78,7 @@ public class UIShapeDemo00 { scene.setPMVMatrixSetup(new MyPMVMatrixSetup()); scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); scene.addShape(shape); + scene.setAAQuality(options.graphAAQuality); final Animator animator = new Animator(0 /* w/o AWT */); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java index 67f466501..d814dbc63 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java @@ -180,6 +180,7 @@ public class UIShapeDemo01 implements GLEventListener { final float sz2 = 1/20f; button = new Button(renderModes, font, "Click me!", sz1_w, sz1_w/2f); button.setLabelColor(0.0f,0.0f,0.0f, 1.0f); + button.setAAQuality(options.graphAAQuality); /** Button defaults ! button.setLabelColor(1.0f,1.0f,1.0f); button.setButtonColor(0.6f,0.6f,0.6f); @@ -189,6 +190,7 @@ public class UIShapeDemo01 implements GLEventListener { System.err.println(button); crossHair = new CrossHair(renderModes, sz2, sz2, 1/1000f); crossHair.setColor(0f,0f,1f,1f); + crossHair.setAAQuality(options.graphAAQuality); crossHair.setVisible(true); } @@ -231,7 +233,7 @@ public class UIShapeDemo01 implements GLEventListener { } } - final int[] sampleCount = { 4 }; + final int[] sampleCount = { options.graphAASamples }; private void drawShape(final GL2ES2 gl, final RegionRenderer renderer, final Shape shape) { final PMVMatrix4f pmv = renderer.getMatrix(); @@ -290,7 +292,7 @@ public class UIShapeDemo01 implements GLEventListener { pmv.pushMv(); pmv.scaleMv(txt_scale, txt_scale, 1f); pmv.translateMv(-txt_box_em.getWidth(), 0f, 0f); - final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, new Vec4f( 0, 0, 0, 1 ), sampleCount, tempT1, tempT2); + final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, new Vec4f( 0, 0, 0, 1 ), options.graphAAQuality, sampleCount, tempT1, tempT2); if( once ) { final AABBox txt_box_em2 = font.getGlyphShapeBounds(null, text); System.err.println("XXX: full_width: "+full_width_o+" / "+txt_box_em.getWidth()+" -> "+full_width_s); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java index c1a5efe77..f2c66121b 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java @@ -39,6 +39,7 @@ import com.jogamp.graph.font.Font; import com.jogamp.graph.font.Font.Glyph; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontSet; +import com.jogamp.graph.ui.GraphShape; import com.jogamp.graph.ui.Shape; import com.jogamp.graph.ui.shapes.CrossHair; import com.jogamp.graph.ui.shapes.Rectangle; @@ -167,7 +168,7 @@ public class UITypeDemo01 implements GLEventListener { private final boolean trace; private final CrossHair crossHair; - private final Shape testObj; + private final GraphShape testObj; private KeyAction keyAction; private MouseAction mouseAction; @@ -200,6 +201,7 @@ public class UITypeDemo01 implements GLEventListener { crossHair = new CrossHair(renderModes, 1/20f, 1/20f, 1/1000f); crossHair.setColor(0f,0f,1f,1f); + crossHair.setAAQuality(options.graphAAQuality); crossHair.setVisible(true); if (false ) { @@ -209,12 +211,13 @@ public class UITypeDemo01 implements GLEventListener { } else { final float scale = 0.15312886f; final float size_xz = 0.541f; - final Shape o = new Glyph03FreeMonoRegular_M(renderModes); + final GraphShape o = new Glyph03FreeMonoRegular_M(renderModes); o.scale(scale, scale, 1f); // o.translate(size_xz, -size_xz, 0f); testObj = o; } testObj.setColor(0f, 0f, 0f, 1f); + testObj.setAAQuality(options.graphAAQuality); testObj.setVisible(true); } @@ -256,7 +259,7 @@ public class UITypeDemo01 implements GLEventListener { } float lastWidth = 0f, lastHeight = 0f; - final int[] sampleCount = { 4 }; + final int[] sampleCount = { options.graphAASamples }; private void drawShape(final GL2ES2 gl, final PMVMatrix4f pmv, final RegionRenderer renderer, final Shape shape) { pmv.pushMv(); @@ -330,7 +333,7 @@ public class UITypeDemo01 implements GLEventListener { if( null != glyph.getShape() ) { final GLRegion region = GLRegion.create(gl.getGLProfile(), renderModes, null, glyph.getShape()); region.addOutlineShape(glyph.getShape(), null, fg_color); - region.draw(gl, renderer, Region.MAX_AA_QUALITY, sampleCount); + region.draw(gl, renderer, options.graphAAQuality, sampleCount); region.destroy(gl); } if( once ) { @@ -348,7 +351,7 @@ public class UITypeDemo01 implements GLEventListener { final float txt_scale = full_width_s < full_height_s ? full_width_s/2f : full_height_s/2f; pmv.scaleMv(txt_scale, txt_scale, 1f); pmv.translateMv(-txt_box_em.getWidth(), 0f, 0f); - final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, fg_color, sampleCount, tempT1, tempT2); + final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, fg_color, options.graphAAQuality, sampleCount, tempT1, tempT2); if( once ) { final AABBox txt_box_em2 = font.getGlyphShapeBounds(null, text); System.err.println("XXX: full_width: "+full_width_o+" / "+txt_box_em.getWidth()+" -> "+full_width_s); diff --git a/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java b/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java index d4d414252..a5e748ae8 100644 --- a/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java +++ b/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java @@ -38,6 +38,8 @@ public class CommandlineOptions { public int sceneMSAASamples = 0; /** Sample count for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link Region#VBAA_RENDERING_BIT} or {@link Region#MSAA_RENDERING_BIT} */ public int graphAASamples = 0; + /** Pass2 AA-quality rendering for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link #VBAA_RENDERING_BIT}. Defaults to {@link Region#DEFAULT_AA_QUALITY}. */ + public int graphAAQuality = Region.DEFAULT_AA_QUALITY; public boolean exclusiveContext = false; public boolean wait_to_start = false; public boolean keepRunning = false; @@ -126,6 +128,9 @@ public class CommandlineOptions { graphAASamples = MiscUtils.atoi(args[idx[0]], 4); renderModes &= ~Region.AA_RENDERING_MASK; renderModes |= Region.VBAA_RENDERING_BIT; + } else if(args[idx[0]].equals("-gaaq")) { + ++idx[0]; + graphAAQuality = Region.clipAAQuality( MiscUtils.atoi(args[idx[0]], graphAAQuality) ); } else if(args[idx[0]].equals("-exclusiveContext")) { exclusiveContext = true; } else if(args[idx[0]].equals("-wait")) { @@ -160,7 +165,7 @@ public class CommandlineOptions { @Override public String toString() { return "Options{surface[width "+surface_width+" x "+surface_height+"], glp "+glProfileName+ - ", renderModes "+Region.getRenderModeString(renderModes)+ + ", renderModes "+Region.getRenderModeString(renderModes)+", aa-q "+graphAAQuality+ ", smsaa "+sceneMSAASamples+ ", exclusiveContext "+exclusiveContext+", wait "+wait_to_start+", keep "+keepRunning+", stay "+stayOpen+", dur "+total_duration+"s"+ "}"; |