From 3f2e0d3a9a6cab80936851c44f61107a2993ddfe Mon Sep 17 00:00:00 2001
From: Sven Gothel
- * The {@link GLAutoDrawable}'s original {@link GLEventListener} are moved to local storage.
- * This renderer {@link GLEventListener} is then added to handle the tile rendering
+ * The {@link GLAutoDrawable}'s original {@link GLEventListener} are moved to this tile renderer.
+ * This tile renderer's {@link GLEventListener} is then added to handle the tile rendering
* for the original {@link GLEventListener}, i.e. it's {@link GLEventListener#display(GLAutoDrawable) display} issues:
*
+ * It is highly recommended that the original {@link GLEventListener} implement
+ * {@link TileRendererNotify}, so they get {@link TileRendererNotify#addTileRendererNotify(TileRendererBase) notified}
+ * about this event.
+ *
*
*
+ * The PMV Matrix shall be reshaped in the
+ * original {@link GLEventListener}'s {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape} method
+ * according to the tile-position, -size and image-size
+ * The {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape} method is called for each tile
+ * w/ the current viewport of tile-size, where the tile-position and image-size can be retrieved by this tile renderer,
+ * see details in {@link #beginTile(GL2ES3)}.
+ * The original {@link GLEventListener} implementing {@link TileRendererNotify} is aware of this
+ * tile renderer instance.
+ *
* Consider using {@link #setGLEventListener(GLEventListener, GLEventListener)} to add pre- and post
* hooks to be performed on this renderer {@link GLEventListener}.
* The pre-hook is able to allocate memory and setup parameters, since it's called before {@link #beginTile(GL2ES3)}.
@@ -242,12 +269,6 @@ public abstract class TileRendererBase {
* Call {@link #detachFromAutoDrawable()} to remove this renderer from the {@link GLAutoDrawable}
* and to restore it's original {@link GLEventListener}.
*
- * The PMV Matrix shall be reshaped in the - * original {@link GLEventListener}'s {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape} - * method. The latter is called for each tile w/ the current viewport. - * The tile's position and image size can be utilized. See details in {@link #beginTile(GL2ES3)}. - *
* @param glad * @throws IllegalStateException if an {@link GLAutoDrawable} is already attached */ @@ -264,6 +285,9 @@ public abstract class TileRendererBase { final GLEventListener l = glad.getGLEventListener(0); listenersInit[i] = glad.getGLEventListenerInitState(l); listeners[i] = glad.removeGLEventListener( l ); + if( listeners[i] instanceof TileRendererNotify ) { + ((TileRendererNotify)listeners[i]).addTileRendererNotify(this); + } } glad.addGLEventListener(tiledGLEL); } @@ -271,6 +295,11 @@ public abstract class TileRendererBase { /** * Detaches this renderer from the {@link GLAutoDrawable}. *+ * It is highly recommended that the original {@link GLEventListener} implement + * {@link TileRendererNotify}, so they get {@link TileRendererNotify#removeTileRendererNotify(TileRendererBase) notified} + * about this event. + *
+ ** See {@link #attachToAutoDrawable(GLAutoDrawable)}. *
*/ @@ -280,6 +309,9 @@ public abstract class TileRendererBase { final int aSz = listenersInit.length; for(int i=0; i