From b91fe4cd16646f134ce8242af30a9f69ecc6ca3e Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Tue, 5 Sep 2023 02:28:41 +0200
Subject: GraphUI Scene: Add invoke(boolean wait, GLRunnable) for convenience
 using GLAutoDrawable.invoke(..)

---
 src/graphui/classes/com/jogamp/graph/ui/Scene.java | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

(limited to 'src/graphui')

diff --git a/src/graphui/classes/com/jogamp/graph/ui/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/Scene.java
index 2cb392c83..c9b28b78a 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Scene.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Scene.java
@@ -373,6 +373,27 @@ public final class Scene implements Container, GLEventListener {
         renderer.init(drawable.getGL().getGL2ES2());
     }
 
+    /**
+     * Enqueues a one-shot {@link GLRunnable},
+     * which will be executed within the next {@link GLAutoDrawable#display()} call
+     * if this {@link Scene} has been added as a {@link GLEventListener} and {@link #init(GLAutoDrawable)} has been called.
+     * <p>
+     * See {@link GLAutoDrawable#invoke(boolean, GLRunnable)}.
+     * </p>
+     *
+     * @param wait if <code>true</code> block until execution of <code>glRunnable</code> is finished, otherwise return immediately w/o waiting
+     * @param glRunnable the {@link GLRunnable} to execute within {@link #display()}
+     * @return <code>true</code> if the {@link GLRunnable} has been processed or queued, otherwise <code>false</code>.
+     * @throws IllegalStateException in case of a detected deadlock situation ahead, see above.
+     * @see GLAutoDrawable#invoke(boolean, GLRunnable)
+     */
+    public boolean invoke(final boolean wait, final GLRunnable glRunnable) throws IllegalStateException  {
+        if( null != cDrawable ) {
+            return cDrawable.invoke(wait, glRunnable);
+        }
+        return false;
+    }
+
     /**
      * Reshape scene using {@link #setupMatrix(PMVMatrix, int, int, int, int)} using {@link PMVMatrixSetup}.
      * <p>
-- 
cgit v1.2.3