From 963457df750d78bf70b5d705a90010215835f5f6 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 17 Feb 2023 14:24:47 +0100 Subject: Graph Demos: Formatting .. GPUUISceneGLListener0A: Formatting and move reshape() after init() --- .../test/junit/graph/demos/GPUTextNewtDemo.java | 2 +- .../junit/graph/demos/GPUUISceneGLListener0A.java | 160 ++++++++++----------- .../test/junit/graph/demos/GPUUISceneNewtDemo.java | 5 +- 3 files changed, 82 insertions(+), 85 deletions(-) (limited to 'src/test/com') diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java index 59956b435..ef6208fa7 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java @@ -148,7 +148,7 @@ public class GPUTextNewtDemo { // FPSAnimator animator = new FPSAnimator(60); final Animator animator = new Animator(); - // animator.setUpdateFPSFrames(60, System.err); + animator.setUpdateFPSFrames(60, null); animator.add(window); window.addKeyListener(new KeyAdapter() { 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 1a74264cd..bfc848774 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 @@ -113,7 +113,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { private final String truePtSize = fontSizePt+" pt font size label - true scale!"; public GPUUISceneGLListener0A() { - this(0); + this(0); } /** @@ -127,7 +127,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { * @param renderModes */ public GPUUISceneGLListener0A(final int renderModes) { - this(renderModes, false, false); + this(renderModes, false, false); } /** @@ -524,7 +524,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { final GLMediaPlayer mPlayer = GLMediaPlayerFactory.createDefault(); mPlayer.setTextureUnit(texUnitMediaPlayer); final MediaPlayerButton mPlayerButton = new MediaPlayerButton(renderer.getRenderState().getVertexFactory(), renderModes, - button2XSize, button2YSize, mPlayer); + button2XSize, button2YSize, mPlayer); mPlayerButton.setVerbose(true); mPlayerButton.addDefaultEventListener(); mPlayerButton.translate(xStartRight, yStartTop - diffY*1, 0f); @@ -548,7 +548,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { if( true ) { final ImageSequence imgSeq = new ImageSequence(texUnitImageButton, true); final ImageSeqButton imgButton = new ImageSeqButton(renderer.getRenderState().getVertexFactory(), renderModes, - button2XSize, button2YSize, imgSeq); + button2XSize, button2YSize, imgSeq); try { imgSeq.addFrame(gl, GPUUISceneGLListener0A.class, "button-released-145x53.png", TextureIO.PNG); imgSeq.addFrame(gl, GPUUISceneGLListener0A.class, "button-pressed-145x53.png", TextureIO.PNG); @@ -606,9 +606,9 @@ public class GPUUISceneGLListener0A implements GLEventListener { }; } final GLEventListenerButton glelButton = new GLEventListenerButton(renderer.getRenderState().getVertexFactory(), renderModes, - button2XSize, button2YSize, - texUnitGLELButton, glel, false /* useAlpha */, - (int)(button2XSize), (int)(button2YSize)); + button2XSize, button2YSize, + texUnitGLELButton, glel, false /* useAlpha */, + (int)(button2XSize), (int)(button2YSize)); glelButton.setToggleable(true); glelButton.setToggle(false); // toggle == true -> animation glelButton.setAnimate(false); @@ -627,20 +627,19 @@ public class GPUUISceneGLListener0A implements GLEventListener { strings = new String[4]; int i = 0; - strings[i++] = - "- Mouse Scroll Over Object\n"+ - " - General\n"+ - " - Z Translation\n"+ - " - Ctrl: Y-Rotation (Shift: X-Rotation)\n"+ - " - Tilt, Space and Corner\n"+ - " - Their respective action via wheel\n"+ - " (shift = other value)\n"+ - "\n"+ - "- Mouse Drag On Object\n"+ - " - Click on Object and drag mouse\n"+ - " - Current postion in status line at bottom\n"+ - "\n"+ - "- Tilt Button Rotate Whole Button Group"; + strings[i++] = "- Mouse Scroll Over Object\n"+ + " - General\n"+ + " - Z Translation\n"+ + " - Ctrl: Y-Rotation (Shift: X-Rotation)\n"+ + " - Tilt, Space and Corner\n"+ + " - Their respective action via wheel\n"+ + " (shift = other value)\n"+ + "\n"+ + "- Mouse Drag On Object\n"+ + " - Click on Object and drag mouse\n"+ + " - Current postion in status line at bottom\n"+ + "\n"+ + "- Tilt Button Rotate Whole Button Group"; strings[i++] = "abcdefghijklmn\nopqrstuvwxyz\n"+ "ABCDEFGHIJKL\n"+ @@ -649,14 +648,13 @@ public class GPUUISceneGLListener0A implements GLEventListener { strings[i++] = "The quick brown fox\njumps over the lazy\ndog"; - strings[i++] = - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec \n"+ - "Ut purus odio, rhoncus sit amet commodo eget, ullamcorper vel\n"+ - "quam iaculis urna cursus ornare. Nullam ut felis a ante ultrices\n"+ - "In hac habitasse platea dictumst. Vivamus et mi a quam lacinia\n"+ - "Morbi quis bibendum nibh. Donec lectus orci, sagittis in consequat\n"+ - "Donec ut dolor et nulla tristique varius. In nulla magna, fermentum\n"+ - "in lorem. Maecenas in ipsum ac justo scelerisque sollicitudin.\n"; + strings[i++] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec \n"+ + "Ut purus odio, rhoncus sit amet commodo eget, ullamcorper vel\n"+ + "quam iaculis urna cursus ornare. Nullam ut felis a ante ultrices\n"+ + "In hac habitasse platea dictumst. Vivamus et mi a quam lacinia\n"+ + "Morbi quis bibendum nibh. Donec lectus orci, sagittis in consequat\n"+ + "Donec ut dolor et nulla tristique varius. In nulla magna, fermentum\n"+ + "in lorem. Maecenas in ipsum ac justo scelerisque sollicitudin.\n"; labels = new Label[i]; } @@ -768,6 +766,49 @@ public class GPUUISceneGLListener0A implements GLEventListener { } } + @Override + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { + System.err.println("GPUUISceneGLListener0A: reshape"); + + // + // Layout all shapes: Relational move regarding window coordinates + // + final float dw = width - lastWidth; + final float dh = height - lastHeight; + + final float dz = 0f; + final float dyTop = dh * relTop; + final float dxLeft = dw * relLeft; + final float dxRight = dw; + + for(int i=0; i