From 26f66b4d18d8e148ece2af57ce39e9b4a5d5b1fb Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 17 Feb 2023 15:07:40 +0100 Subject: Graph GPUUISceneGLListener0A: Prep for reshape_resize, notch up relative sizes a little --- .../junit/graph/demos/GPUUISceneGLListener0A.java | 128 ++++++++++++++------- 1 file changed, 88 insertions(+), 40 deletions(-) (limited to 'src/test/com/jogamp/opengl') diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java index bfc848774..790315354 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java @@ -80,9 +80,9 @@ public class GPUUISceneGLListener0A implements GLEventListener { private final float buttonXSizePVP = 0.105f; private final float fontSizePt = 10f; /** Proportional Font Size to Window Height for Main Text, per-vertical-pixels [PVP] */ - private final float fontSizeFixedPVP = 0.03f; + private final float fontSizeFixedPVP = 0.04f; /** Proportional Font Size to Window Height for FPS Status Line, per-vertical-pixels [PVP] */ - private final float fontSizeFpsPVP = 0.03f; + private final float fontSizeFpsPVP = 0.04f; private float dpiH = 96; /** @@ -660,7 +660,85 @@ public class GPUUISceneGLListener0A implements GLEventListener { } - final boolean enableOthers = true; + private static final boolean enableOthers = true; + private static final boolean reshape_resize = false; // incomplete: button positioning + + + private void setupUI(final GLAutoDrawable drawable) { + final float pixelSizeFixed = fontSizeFixedPVP * drawable.getSurfaceHeight(); + jogampLabel = new Label(renderer.getRenderState().getVertexFactory(), renderModes, font, pixelSizeFixed, jogamp); + jogampLabel.addMouseListener(dragZoomRotateListener); + sceneUIController.addShape(jogampLabel); + jogampLabel.setEnabled(enableOthers); + + final float pixelSize10Pt = FontScale.toPixels(fontSizePt, dpiH); + System.err.println("10Pt PixelSize: Display "+dpiH+" dpi, fontSize "+fontSizePt+" ppi -> "+pixelSize10Pt+" pixel-size"); + truePtSizeLabel = new Label(renderer.getRenderState().getVertexFactory(), renderModes, font, pixelSize10Pt, truePtSize); + sceneUIController.addShape(truePtSizeLabel); + truePtSizeLabel.setEnabled(enableOthers); + truePtSizeLabel.translate(0, - 1.5f * jogampLabel.getLineHeight(), 0f); + truePtSizeLabel.setColor(0.1f, 0.1f, 0.1f, 1.0f); + + /** + * + * [Label] Display 112.88889 dpi, fontSize 12.0 ppi -> pixelSize 18.814816 + * [FPS] Display 112.88889 dpi, fontSize 12.0 ppi -> pixelSize 15.679012 + */ + final float pixelSizeFPS = fontSizeFpsPVP * drawable.getSurfaceHeight(); + fpsLabel = new Label(renderer.getRenderState().getVertexFactory(), renderModes, font, pixelSizeFPS, "Nothing there yet"); + fpsLabel.addMouseListener(dragZoomRotateListener); + sceneUIController.addShape(fpsLabel); + fpsLabel.setEnabled(enableOthers); + fpsLabel.setColor(0.3f, 0.3f, 0.3f, 1.0f); + + crossHairCtr = new CrossHair(renderer.getRenderState().getVertexFactory(), 0, 100f, 100f, 2f); + crossHairCtr.addMouseListener(dragZoomRotateListener); + sceneUIController.addShape(crossHairCtr); + crossHairCtr.setEnabled(true); + crossHairCtr.translate(0f, 0f, -1f); + + initButtons(drawable.getGL().getGL2ES2(), drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), renderer); + for(int i=0; i "+pixelSize10Pt+" pixel-size"); + truePtSizeLabel.setPixelSize(pixelSize10Pt); + + /** + * + * [Label] Display 112.88889 dpi, fontSize 12.0 ppi -> pixelSize 18.814816 + * [FPS] Display 112.88889 dpi, fontSize 12.0 ppi -> pixelSize 15.679012 + */ + final float pixelSizeFPS = fontSizeFpsPVP * drawable.getSurfaceHeight(); + fpsLabel.setPixelSize(pixelSizeFPS); + + final float buttonXSize = buttonXSizePVP * drawable.getSurfaceWidth(); + // final float buttonYSize = buttonYSizePVP * height; + final float buttonYSize = buttonXSize / 2.5f; + final float button2XSize = 2f*buttonXSize; + final float button2YSize = 2f*buttonYSize; + + for(int i=0; i "+pixelSize10Pt+" pixel-size"); - truePtSizeLabel = new Label(renderer.getRenderState().getVertexFactory(), renderModes, font, pixelSize10Pt, truePtSize); - sceneUIController.addShape(truePtSizeLabel); - truePtSizeLabel.setEnabled(enableOthers); - truePtSizeLabel.translate(0, - 1.5f * jogampLabel.getLineHeight(), 0f); - truePtSizeLabel.setColor(0.1f, 0.1f, 0.1f, 1.0f); - - /** - * - * [Label] Display 112.88889 dpi, fontSize 12.0 ppi -> pixelSize 18.814816 - * [FPS] Display 112.88889 dpi, fontSize 12.0 ppi -> pixelSize 15.679012 - */ - final float pixelSizeFPS = fontSizeFpsPVP * drawable.getSurfaceHeight(); - fpsLabel = new Label(renderer.getRenderState().getVertexFactory(), renderModes, font, pixelSizeFPS, "Nothing there yet"); - fpsLabel.addMouseListener(dragZoomRotateListener); - sceneUIController.addShape(fpsLabel); - fpsLabel.setEnabled(enableOthers); - fpsLabel.setColor(0.3f, 0.3f, 0.3f, 1.0f); - - crossHairCtr = new CrossHair(renderer.getRenderState().getVertexFactory(), 0, 100f, 100f, 2f); - crossHairCtr.addMouseListener(dragZoomRotateListener); - sceneUIController.addShape(crossHairCtr); - crossHairCtr.setEnabled(true); - crossHairCtr.translate(0f, 0f, -1f); - - initButtons(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), renderer); - for(int i=0; i