From 93adc67938cfcf00fc5f5f5efb78cd6319ffdc31 Mon Sep 17 00:00:00 2001 From: Sven Göthel Date: Sun, 21 Jan 2024 06:20:05 +0100 Subject: GraphUI Demos: Minor finetuning.. --- .../jogamp/opengl/demos/graph/ui/FontView01.java | 24 +++++++++++++++------- .../demos/graph/ui/UIShapeClippingDemo00.java | 1 + .../demos/graph/ui/UIShapeClippingDemo01.java | 8 ++++---- 3 files changed, 22 insertions(+), 11 deletions(-) (limited to 'src/demos/com/jogamp') 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 fd42d86ca..c010c4f07 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java @@ -86,23 +86,28 @@ import com.jogamp.opengl.util.Animator; * This may become a little font viewer application, having FontForge as its role model. *

* Notable: The actual {@link GlyphShape} created for the glyph-grid {@link Group} - * is reused as-is in the bigger info-grid as well as for the {@link TooltipShape}. + * is reused as-is in the top-right info-box as well as in the {@link TooltipShape}. *

*

- * This is possible only if not modifying the scale or position of the {@link GlyphShape}, + * This is possible only when not modifying the scale or position of the {@link GlyphShape}, * achieved by simply wrapping it in a {@link Group}. * The latter gets scaled and translated when dropped - * into a {@link Group} with {@link Group.Layout}.
+ * into each target {@link Group} with a {@link Group.Layout}.
*

*

- * This is a good example for a Directed Acyclic Graph (DAG). + * This is also good example using GraphUI with a Directed Acyclic Graph (DAG) arrangement. *

*/ public class FontView01 { - private static final float GlyphGridWidth = 3/4f; + private static final float GlyphGridWidth = 3/4f; // FBO AA: 3/4f = 0.75f dropped fine grid lines @ 0.2f thickness; 0.70f OK + private static final float GlyphGridBorderThickness = 0.02f; // thickness 0.2f dropping + private static final Vec4f GlyphGridBorderColor = new Vec4f(0.2f, 0.2f, 0.2f, 1); + // static CommandlineOptions options = new CommandlineOptions(1280, 720, Region.MSAA_RENDERING_BIT, Region.DEFAULT_AA_QUALITY, 4); static CommandlineOptions options = new CommandlineOptions(1280, 720, Region.VBAA_RENDERING_BIT); + static int max_glyph_count = 10000; + private static boolean VERBOSE_GLYPHS = false; private static boolean VERBOSE_UI = false; @@ -134,6 +139,9 @@ public class FontView01 { showLabel = true; } else if(args[idx[0]].equals("-perf")) { perfanal = true; + } else if(args[idx[0]].equals("-maxGlyphs")) { + idx[0]++; + max_glyph_count = MiscUtils.atoi(args[idx[0]], max_glyph_count); } } } @@ -228,6 +236,8 @@ public class FontView01 { // System.err.println("ShapeEvent "+shapeEvent); final GlyphShape g0 = getGlyphShape(shapeEvent.shape); + e.setConsumed(true); + // Selected Glyph g0 final boolean doScreenshot = e.isControlDown() && e.getButtonDownCount() > 0; scene.invoke(false, (final GLAutoDrawable d) -> { @@ -445,7 +455,7 @@ public class FontView01 { final long t0 = Clock.currentNanos(); contourChars.clear(); maxNameLen = 1; - final int[] max = { 10000 }; + final int[] max = { max_glyph_count }; font.forAllGlyphs((final Glyph fg) -> { if( !fg.isNonContour() && max[0]-- > 0 ) { contourChars.add( fg.getCodepoint() ); @@ -501,7 +511,7 @@ public class FontView01 { final AABBox gbox = fg.getBounds(tmpBox); // g.getBounds(glp); final boolean addUnderline = showUnderline && gbox.getMinY() < 0f; final Group c1 = new Group( new BoxLayout( 1f, 1f, addUnderline ? Alignment.None : Alignment.Center) ); - c1.setBorder(0.02f).setBorderColor(0.1f, 0.1f, 0.1f, 1).setInteractive(true).setDragAndResizeable(false).setName("GlyphHolder2"); + c1.setBorder(GlyphGridBorderThickness).setBorderColor(GlyphGridBorderColor).setInteractive(true).setDragAndResizeable(false).setName("GlyphHolder2"); if( addUnderline ) { final Shape underline = new Rectangle(options.renderModes, 1f, gbox.getMinY(), 0.01f).setInteractive(false).setColor(0f, 0f, 1f, 0.25f); c1.addShape(underline); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java index ca8ea8c5b..c0d8babe1 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java @@ -113,6 +113,7 @@ public class UIShapeClippingDemo00 implements GLEventListener { uiGLListener.attachInputListenerTo(window); window.addGLEventListener(uiGLListener); window.setVisible(true); + System.out.println("Chosen: " + window.getChosenGLCapabilities()); final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(5*60, null); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo01.java index 887284f99..35de00965 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo01.java @@ -97,14 +97,14 @@ public class UIShapeClippingDemo01 { scene.setAAQuality(options.graphAAQuality); final Animator animator = new Animator(0 /* w/o AWT */); - final GLCapabilities caps = new GLCapabilities(reqGLP); - caps.setAlphaBits(4); - System.out.println("Requested: " + caps); + final GLCapabilities reqCaps = options.getGLCaps(); + System.out.println("Requested: " + reqCaps); - final GLWindow window = GLWindow.create(caps); + final GLWindow window = GLWindow.create(reqCaps); window.setSize(options.surface_width, options.surface_height); window.setTitle(UIShapeClippingDemo01.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight()); window.setVisible(true); + System.out.println("Chosen: " + window.getChosenGLCapabilities()); window.addGLEventListener(scene); window.addGLEventListener(new GLEventListener() { GraphShape shape = null; -- cgit v1.2.3