diff options
author | Sven Gothel <[email protected]> | 2023-12-04 13:41:24 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-12-04 13:41:24 +0100 |
commit | 75955684c15c593133d619ddc38ad5674073de38 (patch) | |
tree | 0d5fff4ee105272ae735d1aed72953ffb8030f8b /src | |
parent | 2e3092d1ed533b819e2b6442e0d9563818599564 (diff) |
GraphUI Scene: Allow attaching GLAutoDrawable manually and adding GLEventListener (API)
Diffstat (limited to 'src')
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/Scene.java | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/Scene.java index 28855d99c..e35ce5c31 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Scene.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Scene.java @@ -222,7 +222,16 @@ public final class Scene implements Container, GLEventListener { @Override public final boolean isFrustumCullingEnabled() { return doFrustumCulling; } + public void attachGLAutoDrawable(final GLAutoDrawable drawable) { + cDrawable = drawable; + } + public void detachGLAutoDrawable(final GLAutoDrawable drawable) { + if( cDrawable == drawable ) { + cDrawable = null; + } + } public void attachInputListenerTo(final GLWindow window) { + cDrawable = window; if(null == sbcMouseListener) { sbcMouseListener = new SBCMouseListener(); window.addMouseListener(sbcMouseListener); @@ -382,7 +391,9 @@ public final class Scene implements Container, GLEventListener { @Override public void init(final GLAutoDrawable drawable) { - cDrawable = drawable; + if( null == cDrawable ) { + cDrawable = drawable; + } renderer.init(drawable.getGL().getGL2ES2()); } @@ -407,6 +418,17 @@ public final class Scene implements Container, GLEventListener { return false; } + public void addGLEventListener(final GLEventListener listener) { + if( null != cDrawable ) { + cDrawable.addGLEventListener(listener); + } + } + public void removeGLEventListener(final GLEventListener listener) { + if( null != cDrawable ) { + cDrawable.removeGLEventListener(listener); + } + } + /** * Reshape scene using {@link #setupMatrix(PMVMatrix4f, int, int, int, int)} using {@link PMVMatrixSetup}. * <p> @@ -543,8 +565,10 @@ public final class Scene implements Container, GLEventListener { } } shapes.clear(); - cDrawable = null; disposeActions.clear(); + if( drawable == cDrawable ) { + cDrawable = null; + } renderer.destroy(gl); screenshot.dispose(gl); } |