diff options
author | Sven Gothel <[email protected]> | 2023-03-21 09:42:49 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-21 09:42:49 +0100 |
commit | 989a20559ebaa387f8f253c8415e41f6da925d82 (patch) | |
tree | 308739709b977f8787d9f17eeb5512570db33948 | |
parent | 59a7fdeb4ed36f0014ba1fdcc0ec144c04aaa2d5 (diff) |
GraphUI UISceneDemo*: Use lambdas for GLAutoDrawable.invoke(..) to reduce LOC
GLAutoDrawable.invoke(..) API doc: Add semantics about GLRunnable return value.
3 files changed, 13 insertions, 12 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java index df0f681ad..028e0f6e3 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java @@ -159,12 +159,9 @@ public class UISceneDemo00 { // Move on GL thread to have vsync for free // Otherwise we would need to employ a sleep(..) w/ manual vsync - window.invoke(true, new GLRunnable() { - @Override - public boolean run(final GLAutoDrawable drawable) { - shape.move(dx, 0f, 0f); - return true; - } + window.invoke(true, (drawable) -> { + shape.move(dx, 0f, 0f); + return true; }); } final float has_dur_s = ( ( Clock.currentNanos() / 1000 ) - t0_us ) / 1e6f; // [us] diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java index 436c0d847..4649cc301 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java @@ -168,12 +168,9 @@ public class UISceneDemo01 { // Move on GL thread to have vsync for free // Otherwise we would need to employ a sleep(..) w/ manual vsync - window.invoke(true, new GLRunnable() { - @Override - public boolean run(final GLAutoDrawable drawable) { - shape.move(dx, 0f, 0f); - return true; - } + window.invoke(true, (drawable) -> { + shape.move(dx, 0f, 0f); + return true; }); } final float has_dur_s = ( ( Clock.currentNanos() / 1000 ) - t0_us ) / 1e6f; // [us] diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawable.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawable.java index b9ed73650..a2a04f3fe 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawable.java @@ -417,6 +417,13 @@ public interface GLAutoDrawable extends GLDrawable { * {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)} * methods have been called. * <p> + * The given {@link GLRunnable#run(GLAutoDrawable)} shall return true to indicate + * that the GL [back] framebuffer remains intact by this runnable. <br/> + * If returning false {@link GLAutoDrawable} will call + * {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)} + * of all registered {@link GLEventListener}s once more to reinstate the framebuffer. + * </p> + * <p> * If no {@link GLAnimatorControl} is animating (default),<br> * or if the current thread is the animator thread,<br> * a {@link #display()} call is issued after enqueue the <code>GLRunnable</code>, |