From b91fe4cd16646f134ce8242af30a9f69ecc6ca3e Mon Sep 17 00:00:00 2001 From: Sven Gothel 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') 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. + *

+ * See {@link GLAutoDrawable#invoke(boolean, GLRunnable)}. + *

+ * + * @param wait if true block until execution of glRunnable is finished, otherwise return immediately w/o waiting + * @param glRunnable the {@link GLRunnable} to execute within {@link #display()} + * @return true if the {@link GLRunnable} has been processed or queued, otherwise false. + * @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}. *

-- cgit v1.2.3