From 0d7aa5218c36b291b2d24c8c9bb118b2a8d2e71a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 20 Mar 2023 07:04:54 +0100 Subject: GraphUI Scene: Move GLEventListener implementations reshape() and dispose() to the others, init(), display(). Ease review. --- .../classes/com/jogamp/graph/ui/gl/Scene.java | 96 +++++++++++----------- 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'src/graphui/classes/com/jogamp/graph/ui') diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java index 47411f60f..d94ff286a 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java @@ -265,6 +265,25 @@ public final class Scene implements GLEventListener { display(drawable, shapesS, false); } + /** + * Reshape scene using {@link #setupMatrix(PMVMatrix, int, int, int, int)} using {@link PMVMatrixSetup}. + *

+ * {@inheritDoc} + *

+ * @see PMVMatrixSetup + * @see #setPMVMatrixSetup(PMVMatrixSetup) + * @see #setupMatrix(PMVMatrix, int, int, int, int) + * @see #getBounds() + * @see #getBoundsCenter() + */ + @Override + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { + renderer.reshapeNotify(x, y, width, height); + + setupMatrix(renderer.getMatrix(), x, y, width, height); + pmvMatrixSetup.setPlaneBox(planeBox, renderer.getMatrix(), x, y, width, height); + } + private static final int[] sampleCountGLSelect = { -1 }; private void display(final GLAutoDrawable drawable, final Object[] shapesS, final boolean glSelect) { @@ -338,6 +357,35 @@ public final class Scene implements GLEventListener { } } + /** + * Disposes all {@link #addShape(Shape) added} {@link Shape}s. + *

+ * Implementation also issues {@link RegionRenderer#destroy(GL2ES2)} if set + * and {@link #detachInputListenerFrom(GLWindow)} in case the drawable is of type {@link GLWindow}. + *

+ *

+ * {@inheritDoc} + *

+ */ + @Override + public void dispose(final GLAutoDrawable drawable) { + synchronized ( syncDisplayedOnce ) { + displayedOnce = false; + syncDisplayedOnce.notifyAll(); + } + if( drawable instanceof GLWindow ) { + final GLWindow glw = (GLWindow) drawable; + detachInputListenerFrom(glw); + } + final GL2ES2 gl = drawable.getGL().getGL2ES2(); + for(int i=0; i - * Implementation also issues {@link RegionRenderer#destroy(GL2ES2)} if set - * and {@link #detachInputListenerFrom(GLWindow)} in case the drawable is of type {@link GLWindow}. - *

- *

- * {@inheritDoc} - *

- */ - @Override - public void dispose(final GLAutoDrawable drawable) { - synchronized ( syncDisplayedOnce ) { - displayedOnce = false; - syncDisplayedOnce.notifyAll(); - } - if( drawable instanceof GLWindow ) { - final GLWindow glw = (GLWindow) drawable; - detachInputListenerFrom(glw); - } - final GL2ES2 gl = drawable.getGL().getGL2ES2(); - for(int i=0; i - * {@inheritDoc} - *

- * @see PMVMatrixSetup - * @see #setPMVMatrixSetup(PMVMatrixSetup) - * @see #setupMatrix(PMVMatrix, int, int, int, int) - * @see #getBounds() - * @see #getBoundsCenter() - */ - @Override - public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { - renderer.reshapeNotify(x, y, width, height); - - setupMatrix(renderer.getMatrix(), x, y, width, height); - pmvMatrixSetup.setPlaneBox(planeBox, renderer.getMatrix(), x, y, width, height); - } - /** * Setup {@link PMVMatrix} {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW} * by calling {@link #getPMVMatrixSetup()}'s {@link PMVMatrixSetup#set(PMVMatrix, int, int, int, int)}. -- cgit v1.2.3