summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-03-30 05:32:55 +0200
committerSven Gothel <[email protected]>2023-03-30 05:32:55 +0200
commitadb1373821d60394343b6716a6d0ee179f875a36 (patch)
tree29f2dd983f050ef082fc32624ed3ddc2d06faeb4
parent783e052fc82c188342873c64652dec3a3d505a6e (diff)
GraphUI Demo: UISceneDemo20 use Scene.screenshot(..), drop own code
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java34
1 files changed, 3 insertions, 31 deletions
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 82f09a38a..88b28f24b 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
@@ -40,7 +40,6 @@ import com.jogamp.common.util.IOUtil;
import com.jogamp.common.util.InterruptSource;
import com.jogamp.common.util.VersionUtil;
import com.jogamp.graph.curve.Region;
-import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.graph.font.Font;
import com.jogamp.graph.font.FontFactory;
@@ -84,7 +83,6 @@ import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.math.VectorUtil;
import com.jogamp.opengl.math.geom.AABBox;
import com.jogamp.opengl.util.Animator;
-import com.jogamp.opengl.util.GLReadBufferUtil;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.av.GLMediaPlayer;
import com.jogamp.opengl.util.av.GLMediaPlayerFactory;
@@ -278,8 +276,6 @@ public class UISceneDemo20 implements GLEventListener {
private static final float fontSizePt = 10f;
/** Relative Font Size to Window Height for Main Text, normalized to 1. */
private static final float fontSizeFixedNorm = 0.04f;
- /** Relative Font Size to Window Height for FPS Status Line, normalized to 1. */
- private static final float fontSizeFpsNorm = 0.03f; // 1/18f;
private float dpiV = 96;
/**
@@ -302,8 +298,6 @@ public class UISceneDemo20 implements GLEventListener {
private GLAutoDrawable cDrawable;
- private final GLReadBufferUtil screenshot;
-
private final String jogamp = "JogAmp - Jogl Graph Module Demo";
private final String truePtSize = fontSizePt+" pt font size label - true scale!";
@@ -383,8 +377,6 @@ public class UISceneDemo20 implements GLEventListener {
scene.setPMVMatrixSetup(new MyPMVMatrixSetup());
scene.getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED);
// scene.setSampleCount(3); // easy on embedded devices w/ just 3 samples (default is 4)?
-
- screenshot = new GLReadBufferUtil(false, false);
}
private void rotateButtons(float[] angdeg) {
@@ -682,12 +674,9 @@ public class UISceneDemo20 implements GLEventListener {
button.addMouseListener(new Shape.MouseGestureAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
- cDrawable.invoke(false, new GLRunnable() {
- @Override
- public boolean run(final GLAutoDrawable drawable) {
- printScreen(drawable.getGL());
- return true;
- }
+ cDrawable.invoke(true, (drawable) -> {
+ scene.screenshot(drawable.getGL(), renderModes, UISceneDemo20.class.getSimpleName());
+ return true;
});
} } );
button.addMouseListener(dragZoomRotateListener);
@@ -994,24 +983,7 @@ public class UISceneDemo20 implements GLEventListener {
System.err.println("GPUUISceneGLListener0A: dispose");
scene.dispose(drawable); // disposes all registered UIShapes
-
- final GL2ES2 gl = drawable.getGL().getGL2ES2();
- screenshot.dispose(gl);
- }
-
- public void printScreen(final GL gl) {
- final RegionRenderer renderer = scene.getRenderer();
- final String modeS = Region.getRenderModeString(renderModes);
- final String filename = String.format((Locale)null, "GraphUIDemo-shot%03d-%03dx%03d-S_%s_%02d.png",
- shotCount++, renderer.getWidth(), renderer.getHeight(),
- modeS, scene.getSampleCount());
- gl.glFinish(); // just make sure rendering finished ..
- if(screenshot.readPixels(gl, false)) {
- screenshot.write(new File(filename));
- System.err.println("Wrote: "+filename);
- }
}
- private int shotCount = 0;
@Override
public void display(final GLAutoDrawable drawable) {