summaryrefslogtreecommitdiffstats
path: root/src/demos/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-04-13 06:29:16 +0200
committerSven Gothel <[email protected]>2023-04-13 06:29:16 +0200
commit0017e5f6e7e8410d566dcefd9f42ffd0d4fc61e7 (patch)
tree5ac0b11ced005c1c4f273fea9d1cc8d759420cc6 /src/demos/com
parent823fe11a49ac2160da86cdf894c84efa9fb1ae2c (diff)
GraphUI Scene.screenshot(): Add convenient variant to be executed on-display call. FontView stays open and issues a screenshot.
Diffstat (limited to 'src/demos/com')
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java9
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java5
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03b.java5
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java5
4 files changed, 7 insertions, 17 deletions
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 9b2e524e2..173de4db2 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
@@ -133,7 +133,6 @@ public class FontView01 {
final Scene scene = new Scene();
scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
- scene.addShape(grid);
scene.setFrustumCullingEnabled(true);
final Animator animator = new Animator();
@@ -174,6 +173,7 @@ public class FontView01 {
// - Compute the animation values with DPI
scene.waitUntilDisplayed();
+ grid.validate(reqGLP); // pre-validate to move & scale before display
final AABBox sceneBox = scene.getBounds();
System.err.println("SceneBox "+sceneBox);
final float sxy = sceneBox.getWidth() < sceneBox.getHeight() ? sceneBox.getWidth() : sceneBox.getHeight();
@@ -182,12 +182,11 @@ public class FontView01 {
final float sgxy = sxy / gxy;
grid.scale(sgxy, sgxy, 1f);
grid.moveTo(sceneBox.getMinX(), sceneBox.getMinY(), 0f);
+ scene.addShape(grid); // late add at correct position and size
System.err.println("Grid "+grid);
System.err.println("Grid "+grid.getLayout());
System.err.println("Grid[0] "+grid.getShapes().get(0));
- try { Thread.sleep(1000); } catch (final InterruptedException e1) { }
- if( !options.stayOpen ) {
- window.destroy();
- }
+ scene.screenshot(true, options.renderModes, FontView01.class.getSimpleName());
+ // stay open ..
}
}
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 d49be6bf0..4bfe718d7 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
@@ -393,10 +393,7 @@ public class UISceneDemo03 {
final float has_dur_s = ((Clock.currentNanos() / 1000) - t0_us) / 1e6f; // [us]
System.err.printf("Text travel-duration %.3f s, %d chars%n", has_dur_s, originalTexts[txt_idx].length());
if( scene.getScreenshotCount() < 1 + originalTexts.length ) {
- window.invoke(true, (drawable) -> {
- scene.screenshot(drawable.getGL(), options.renderModes, UISceneDemo03.class.getSimpleName());
- return true;
- });
+ scene.screenshot(true, options.renderModes, UISceneDemo03.class.getSimpleName());
}
try { Thread.sleep(2000); } catch (final InterruptedException e1) { }
if( autoSpeed > 0 ) {
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03b.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03b.java
index 46201df1e..a3fcbb1af 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03b.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03b.java
@@ -483,10 +483,7 @@ public class UISceneDemo03b {
final float has_dur_s = ((Clock.currentNanos() / 1000) - t0_us) / 1e6f; // [us]
System.err.printf("Text travel-duration %.3f s, %d chars%n", has_dur_s, originalTexts[txt_idx].length());
if( scene.getScreenshotCount() < 1 + originalTexts.length ) {
- window.invoke(true, (drawable) -> {
- scene.screenshot(drawable.getGL(), options.renderModes, UISceneDemo03b.class.getSimpleName());
- return true;
- });
+ scene.screenshot(true, options.renderModes, UISceneDemo03b.class.getSimpleName());
}
try { Thread.sleep(2000); } catch (final InterruptedException e1) { }
if( autoSpeed > 0 ) {
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 4d132814c..0be93f06c 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
@@ -604,10 +604,7 @@ public class UISceneDemo20 implements GLEventListener {
button.addMouseListener(new Shape.MouseGestureAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
- cDrawable.invoke(true, (drawable) -> {
- scene.screenshot(drawable.getGL(), renderModes, UISceneDemo20.class.getSimpleName());
- return true;
- });
+ scene.screenshot(true, renderModes, UISceneDemo20.class.getSimpleName());
} } );
button.addMouseListener(dragZoomRotateListener);
buttonsLeft.addShape(button);