diff options
14 files changed, 320 insertions, 168 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java index 03b782ff8..dcf229716 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java @@ -201,7 +201,7 @@ public class RandomTileRenderer extends TileRendererBase { /** * Rendering one tile, by simply calling {@link GLAutoDrawable#display()}. * - * @throws IllegalStateException if no {@link GLAutoDrawable} is {@link #attachToAutoDrawable(GLAutoDrawable) attached} + * @throws IllegalStateException if no {@link GLAutoDrawable} is {@link #attachAutoDrawable(GLAutoDrawable) attached} * or imageSize is not set */ public void display(int tX, int tY, int tWidth, int tHeight) throws IllegalStateException { diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java index 266909470..7c57627e9 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java @@ -137,7 +137,7 @@ public class TileRenderer extends TileRendererBase { private int rowOrder = TR_BOTTOM_TO_TOP; private int rows; private int columns; - private int currentTile = -1; + private int currentTile = -1; private int currentRow; private int currentColumn; private int offsetX; @@ -269,6 +269,8 @@ public class TileRenderer extends TileRendererBase { assert rows >= 0; } + /* pp */ final int getCurrentTile() { return currentTile; } + /** * Returns <code>true</code> if all tiles have been rendered or {@link #setup()} * has not been called, otherwise <code>false</code>. diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java index 74e1df316..5b3644f59 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java @@ -67,9 +67,9 @@ import jogamp.opengl.Debug; * after calling {@link #beginTile(GL)}, See {@link #beginTile(GL)}. * </p> * <p> - * If {@link #attachToAutoDrawable(GLAutoDrawable) attaching to} an {@link GLAutoDrawable}, - * the {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int)} method - * is being called after {@link #beginTile(GL)}. + * If {@link #attachAutoDrawable(GLAutoDrawable) attaching to} an {@link GLAutoDrawable}, + * the {@link TileRendererListener#reshapeTile(TileRendererBase, int, int, int, int, int, int)} method + * is being called after {@link #beginTile(GL)} for each rendered tile. * It's implementation shall reshape the PMV matrix according to {@link #beginTile(GL)}. * </p> * <a name="glprequirement"><h5>GL Profile Requirement</h5></a> @@ -118,15 +118,97 @@ public abstract class TileRendererBase { /* pp */ static final boolean DEBUG = Debug.debug("TileRenderer"); /** - * Notifies {@link GLEventListener} implementing this interface - * that the owning {@link GLAutoDrawable} is {@link TileRendererBase#attachToAutoDrawable(GLAutoDrawable) attached} - * to a tile renderer or {@link TileRendererBase#detachFromAutoDrawable() detached} from it. + * Listener for tile renderer events, intended to extend {@link GLEventListener} implementations, + * enabling tile rendering via {@link TileRendererBase#attachAutoDrawable(GLAutoDrawable)}. */ - public static interface TileRendererNotify { - /** The owning {@link GLAutoDrawable} is {@link TileRendererBase#attachToAutoDrawable(GLAutoDrawable) attached} to a {@link TileRendererBase}. */ + public static interface TileRendererListener { + /** + * The owning {@link GLAutoDrawable} is {@link TileRendererBase#attachAutoDrawable(GLAutoDrawable) attached} + * to the given {@link TileRendererBase} instance. + * <p> + * The {@link GLContext} of the {@link TileRendererBase}'s {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable} + * <i>is not</i> current. + * </p> + * @param tr the associated {@link TileRendererBase} + * @see TileRendererBase#getAttachedDrawable() + */ public void addTileRendererNotify(TileRendererBase tr); - /** The owning {@link GLAutoDrawable} is {@link TileRendererBase#detachFromAutoDrawable() detached} from a {@link TileRendererBase}. */ + + /** + * The owning {@link GLAutoDrawable} is {@link TileRendererBase#detachAutoDrawable() detached} + * from the given {@link TileRendererBase} instance. + * <p> + * The {@link GLContext} of the {@link TileRendererBase}'s {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable} + * <i>is not</i> current. + * </p> + * @param tr the disassociated {@link TileRendererBase} + * @see TileRendererBase#getAttachedDrawable() + */ public void removeTileRendererNotify(TileRendererBase tr); + + /** + * Called by the {@link TileRendererBase} during tile-rendering via an + * {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable}'s + * {@link GLAutoDrawable#display()} call for each tile before {@link #display(GLAutoDrawable)}. + * <p> + * The <a href="#pmvmatrix">PMV Matrix</a> shall be reshaped + * according to the given + * <ul> + * <li>current tile-position</li> + * <li>current tile-size</li> + * <li>final image-size</li> + * </ul> + * The GL viewport is already set to origin 0/0 and the current tile-size.<br> + * See details in {@link TileRendererBase#beginTile(GL)}.<br> + * </p> + * <p> + * The {@link GLContext} of the {@link TileRendererBase}'s {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable} + * <i>is</i> current. + * </p> + * @param tr the issuing {@link TileRendererBase} + * @param tileX the {@link TileRendererBase#TR_CURRENT_TILE_X_POS current tile's x-pos} + * @param tileY the {@link TileRendererBase#TR_CURRENT_TILE_Y_POS current tile's y-pos} + * @param tileWidth the {@link TileRendererBase#TR_CURRENT_TILE_WIDTH current tile's width} + * @param tileHeight the {@link TileRendererBase#TR_CURRENT_TILE_HEIGHT current tile's height} + * @param imageWidth the {@link TileRendererBase#TR_IMAGE_WIDTH final image width} + * @param imageHeight the {@link TileRendererBase#TR_IMAGE_HEIGHT final image height} + * @see TileRendererBase#getAttachedDrawable() + */ + public void reshapeTile(TileRendererBase tr, + int tileX, int tileY, int tileWidth, int tileHeight, + int imageWidth, int imageHeight); + + /** + * Called by the {@link TileRendererBase} during tile-rendering + * after {@link TileRendererBase#beginTile(GL)} and before {@link #reshapeTile(TileRendererBase, int, int, int, int, int, int) reshapeTile(..)}. + * <p> + * If {@link TileRendererBase} is of type {@link TileRenderer}, + * method is called for the first tile of all tiles.<br> + * Otherwise, i.e. {@link RandomTileRenderer}, method is called for each particular tile. + * </p> + * <p> + * The {@link GLContext} of the {@link TileRenderer}'s {@link TileRenderer#getAttachedDrawable() attached} {@link GLAutoDrawable} + * <i>is</i> current. + * </p> + * @param tr the issuing {@link TileRendererBase} + */ + public void startTileRendering(TileRendererBase tr); + + /** + * Called by the {@link TileRenderer} during tile-rendering + * after {@link TileRendererBase#endTile(GL)} and {@link GLAutoDrawable#swapBuffers()}. + * <p> + * If {@link TileRendererBase} is of type {@link TileRenderer}, + * method is called for the last tile of all tiles.<br> + * Otherwise, i.e. {@link RandomTileRenderer}, method is called for each particular tile. + * </p> + * <p> + * The {@link GLContext} of the {@link TileRenderer}'s {@link TileRenderer#getAttachedDrawable() attached} {@link GLAutoDrawable} + * <i>is</i> current. + * </p> + * @param tr the issuing {@link TileRendererBase} + */ + public void endTileRendering(TileRendererBase tr); } protected final Dimension imageSize = new Dimension(0, 0); @@ -246,13 +328,13 @@ public abstract class TileRendererBase { * <ul> * <li>x 0</li> * <li>y 0</li> - * <li>{@link #TR_CURRENT_TILE_WIDTH tile width}</li> - * <li>{@link #TR_CURRENT_TILE_HEIGHT tile height}</li> + * <li>{@link #TR_CURRENT_TILE_WIDTH current tile's width}</li> + * <li>{@link #TR_CURRENT_TILE_HEIGHT current tile's height}</li> * </ul></li> - * <li>{@link #TR_CURRENT_TILE_X_POS tile x-pos}</li> - * <li>{@link #TR_CURRENT_TILE_Y_POS tile y-pos}</li> - * <li>{@link #TR_IMAGE_WIDTH image width}</li> - * <li>{@link #TR_IMAGE_HEIGHT image height}</li> + * <li>{@link #TR_CURRENT_TILE_X_POS current tile's x-pos}</li> + * <li>{@link #TR_CURRENT_TILE_Y_POS current tile's y-pos}</li> + * <li>{@link #TR_IMAGE_WIDTH final image width}</li> + * <li>{@link #TR_IMAGE_HEIGHT final image height}</li> * </ul> * </p> * <p> @@ -311,12 +393,12 @@ public abstract class TileRendererBase { } /** - * Attaches this renderer to the {@link GLAutoDrawable}. + * Attaches the given {@link GLAutoDrawable} to this tile renderer. + * <p> + * The {@link GLAutoDrawable}'s original {@link GLEventListener} are moved to this tile renderer. + * </p> * <p> - * The {@link GLAutoDrawable}'s original {@link GLEventListener} are moved to this tile renderer.<br> - * It is <i>highly recommended</i> that the original {@link GLEventListener} implement - * {@link TileRendererNotify}, so they get {@link TileRendererNotify#addTileRendererNotify(TileRendererBase) notified} - * about this event. + * {@link GLEventListeners} not implementing {@link TileRendererListener} are ignored while tile rendering. * </p> * <p> * The {@link GLAutoDrawable}'s {@link GLAutoDrawable#getAutoSwapBufferMode() auto-swap mode} is cached @@ -324,15 +406,15 @@ public abstract class TileRendererBase { * see {@link #reqPreSwapBuffers(GLCapabilitiesImmutable)}. * </p> * <p> - * This tile renderer's {@link GLEventListener} is then added to handle the tile rendering, - * replacing the original {@link GLEventListener}.<br> - * This {@link GLEventListener#display(GLAutoDrawable) display} implementations issues: + * This tile renderer's internal {@link GLEventListener} is then added to the attached {@link GLAutoDrawable} + * to handle the tile rendering, replacing the original {@link GLEventListener}.<br> + * It's {@link GLEventListener#display(GLAutoDrawable) display} implementations issues: * <ul> * <li>Optional {@link #setGLEventListener(GLEventListener, GLEventListener) pre-glel}.{@link GLEventListener#display(GLAutoDrawable) display(..)}</li> * <li>{@link #beginTile(GL)}</li> - * <li>for all original {@link GLEventListener}: + * <li>for all original {@link TileRendererListener}: * <ul> - * <li>{@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape(0, 0, tile-width, tile-height)}</li> + * <li>{@link TileRendererListener#reshapeTile(TileRendererBase, int, int, int, int, int, int) reshapeTile(tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight)}</li> * <li>{@link GLEventListener#display(GLAutoDrawable) display(autoDrawable)}</li> * </ul></li> * <li>if ( {@link #reqPreSwapBuffers(GLCapabilitiesImmutable) pre-swap} ) { {@link GLAutoDrawable#swapBuffers() swapBuffers()} }</li> @@ -342,16 +424,6 @@ public abstract class TileRendererBase { * </ul> * </p> * <p> - * The <a href="#pmvmatrix">PMV Matrix</a> 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<br> - * 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(GL)}.<br> - * The original {@link GLEventListener} implementing {@link TileRendererNotify} is aware of this - * tile renderer instance. - * </p> - * <p> * Consider using {@link #setGLEventListener(GLEventListener, GLEventListener)} to add pre- and post * hooks to be performed on this renderer {@link GLEventListener}.<br> * The pre-hook is able to allocate memory and setup parameters, since it's called before {@link #beginTile(GL)}.<br> @@ -359,13 +431,15 @@ public abstract class TileRendererBase { * since it's called after {@link #endTile(GL)}. * </p> * <p> - * Call {@link #detachFromAutoDrawable()} to remove this renderer from the {@link GLAutoDrawable} + * Call {@link #detachAutoDrawable()} to remove the attached {@link GLAutoDrawable} from this tile renderer * and to restore it's original {@link GLEventListener}. * </p> - * @param glad + * @param glad the {@link GLAutoDrawable} to attach. * @throws IllegalStateException if an {@link GLAutoDrawable} is already attached + * @see #getAttachedDrawable() + * @see #detachAutoDrawable() */ - public void attachToAutoDrawable(GLAutoDrawable glad) throws IllegalStateException { + public final void attachAutoDrawable(GLAutoDrawable glad) throws IllegalStateException { if( null != this.glad ) { throw new IllegalStateException("GLAutoDrawable already attached"); } @@ -379,9 +453,9 @@ public abstract class TileRendererBase { listenersInit[i] = glad.getGLEventListenerInitState(l); listeners[i] = glad.removeGLEventListener( l ); final boolean trn; - if( listeners[i] instanceof TileRendererNotify ) { + if( listeners[i] instanceof TileRendererListener ) { trn = true; - ((TileRendererNotify)listeners[i]).addTileRendererNotify(this); + ((TileRendererListener)listeners[i]).addTileRendererNotify(this); } else { trn = false; } @@ -399,25 +473,34 @@ public abstract class TileRendererBase { } } - /** - * Detaches this renderer from the {@link GLAutoDrawable}. - * <p> - * It is <i>highly recommended</i> that the original {@link GLEventListener} implement - * {@link TileRendererNotify}, so they get {@link TileRendererNotify#removeTileRendererNotify(TileRendererBase) notified} - * about this event. - * </p> + /** + * Returns a previously {@link #attachAutoDrawable(GLAutoDrawable) attached} {@link GLAutoDrawable}, + * <code>null</code> if none is attached. * <p> - * See {@link #attachToAutoDrawable(GLAutoDrawable)}. + * If called from {@link TileRendererListener#addTileRendererNotify(TileRendererBase)} + * or {@link TileRendererListener#removeTileRendererNotify(TileRendererBase)}, method returns the + * just attached or soon to be detached {@link GLAutoDrawable}. * </p> + * @see #attachAutoDrawable(GLAutoDrawable) + * @see #detachAutoDrawable() + */ + public final GLAutoDrawable getAttachedDrawable() { + return glad; + } + + /** + * Detaches the given {@link GLAutoDrawable} from this tile renderer. + * @see #attachAutoDrawable(GLAutoDrawable) + * @see #getAttachedDrawable() */ - public void detachFromAutoDrawable() { + public final void detachAutoDrawable() { if( null != glad ) { glad.removeGLEventListener(tiledGLEL); final int aSz = listenersInit.length; for(int i=0; i<aSz; i++) { final GLEventListener l = listeners[i]; - if( l instanceof TileRendererNotify ) { - ((TileRendererNotify)l).removeTileRendererNotify(this); + if( l instanceof TileRendererListener ) { + ((TileRendererListener)l).removeTileRendererNotify(this); } glad.addGLEventListener(l); glad.setGLEventListenerInitState(l, listenersInit[i]); @@ -436,12 +519,12 @@ public abstract class TileRendererBase { /** * Set {@link GLEventListener} for pre- and post operations when used w/ - * {@link #attachToAutoDrawable(GLAutoDrawable)} + * {@link #attachAutoDrawable(GLAutoDrawable)} * for each {@link GLEventListener} callback. * @param preTile the pre operations * @param postTile the post operations */ - public void setGLEventListener(GLEventListener preTile, GLEventListener postTile) { + public final void setGLEventListener(GLEventListener preTile, GLEventListener postTile) { glEventListenerPre = preTile; glEventListenerPost = postTile; } @@ -449,10 +532,10 @@ public abstract class TileRendererBase { /** * Rendering one tile, by simply calling {@link GLAutoDrawable#display()}. * - * @throws IllegalStateException if no {@link GLAutoDrawable} is {@link #attachToAutoDrawable(GLAutoDrawable) attached} + * @throws IllegalStateException if no {@link GLAutoDrawable} is {@link #attachAutoDrawable(GLAutoDrawable) attached} * or imageSize is not set */ - public void display() throws IllegalStateException { + public final void display() throws IllegalStateException { if( null == glad ) { throw new IllegalStateException("No GLAutoDrawable attached"); } @@ -460,6 +543,8 @@ public abstract class TileRendererBase { } private final GLEventListener tiledGLEL = new GLEventListener() { + final TileRenderer tileRenderer = TileRendererBase.this instanceof TileRenderer ? (TileRenderer) TileRendererBase.this : null; + @Override public void init(GLAutoDrawable drawable) { if( null != glEventListenerPre ) { @@ -468,7 +553,7 @@ public abstract class TileRendererBase { final int aSz = listenersInit.length; for(int i=0; i<aSz; i++) { final GLEventListener l = listeners[i]; - if( !listenersInit[i] ) { + if( !listenersInit[i] && l instanceof TileRendererListener ) { l.init(drawable); listenersInit[i] = true; } @@ -483,7 +568,7 @@ public abstract class TileRendererBase { glEventListenerPre.dispose(drawable); } final int aSz = listenersInit.length; - for(int i=0; i<aSz; i++) { + for(int i=0; i<aSz; i++) { // dispose all GLEventListener, last chance! listeners[i].dispose(drawable); } if( null != glEventListenerPost ) { @@ -502,8 +587,17 @@ public abstract class TileRendererBase { final int aSz = listenersInit.length; for(int i=0; i<aSz; i++) { - listeners[i].reshape(drawable, 0, 0, currentTileWidth, currentTileHeight); - listeners[i].display(drawable); + final GLEventListener l = listeners[i]; + if( l instanceof TileRendererListener ) { + final TileRendererListener tl = (TileRendererListener)l; + if( null == tileRenderer || 0 == tileRenderer.getCurrentTile() ) { + tl.startTileRendering(TileRendererBase.this); + } + tl.reshapeTile(TileRendererBase.this, + currentTileXPos, currentTileYPos, currentTileWidth, currentTileHeight, + imageSize.getWidth(), imageSize.getHeight()); + l.display(drawable); + } } if( gladRequiresPreSwap ) { @@ -513,7 +607,14 @@ public abstract class TileRendererBase { endTile(gl); glad.swapBuffers(); } - + if( null == tileRenderer || tileRenderer.eot() ) { + for(int i=0; i<aSz; i++) { + final GLEventListener l = listeners[i]; + if( l instanceof TileRendererListener ) { + ((TileRendererListener)l).endTileRendering(TileRendererBase.this); + } + } + } if( null != glEventListenerPost ) { glEventListenerPost.reshape(drawable, 0, 0, currentTileWidth, currentTileHeight); glEventListenerPost.display(drawable); diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index 1ab30547a..b7c8c42f9 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -784,7 +784,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } printAWTTiles.setIsGLOriented(printGLAD.isGLOriented()); printAWTTiles.renderer.setTileSize(printGLAD.getWidth(), printGLAD.getHeight(), 0); - printAWTTiles.renderer.attachToAutoDrawable(printGLAD); + printAWTTiles.renderer.attachAutoDrawable(printGLAD); if( DEBUG ) { System.err.println("AWT print.setup "+printAWTTiles); System.err.println("AWT print.setup AA "+printNumSamples+", "+caps); diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 61ff4997e..e52317041 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -559,7 +559,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } printAWTTiles.setIsGLOriented(printGLAD.isGLOriented()); printAWTTiles.renderer.setTileSize(printGLAD.getWidth(), printGLAD.getHeight(), 0); - printAWTTiles.renderer.attachToAutoDrawable(printGLAD); + printAWTTiles.renderer.attachAutoDrawable(printGLAD); if( DEBUG ) { System.err.println("AWT print.setup "+printAWTTiles); System.err.println("AWT print.setup AA "+printNumSamples+", "+caps); diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java index 0aab049a0..2b921f799 100644 --- a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java +++ b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java @@ -114,7 +114,7 @@ public class AWTTilePainter { /** * Assumes a configured {@link TileRenderer}, i.e. - * an {@link TileRenderer#attachToAutoDrawable(GLAutoDrawable) attached} + * an {@link TileRenderer#attachAutoDrawable(GLAutoDrawable) attached} * {@link GLAutoDrawable} with {@link TileRenderer#setTileSize(int, int, int) set tile size}. * <p> * Sets the renderer to {@link TileRenderer#TR_TOP_TO_BOTTOM} row order. @@ -241,11 +241,11 @@ public class AWTTilePainter { } /** - * Disposes resources and {@link TileRenderer#detachFromAutoDrawable() detaches} + * Disposes resources and {@link TileRenderer#detachAutoDrawable() detaches} * the {@link TileRenderer}'s {@link GLAutoDrawable}. */ public void dispose() { - renderer.detachFromAutoDrawable(); // tile-renderer -> printGLAD + renderer.detachAutoDrawable(); // tile-renderer -> printGLAD g2d = null; if( null != tBuffer ) { tBuffer.dispose(); diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index eadb69ec2..b2a4ef7d3 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -526,7 +526,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } printAWTTiles.setIsGLOriented(printGLAD.isGLOriented()); printAWTTiles.renderer.setTileSize(printGLAD.getWidth(), printGLAD.getHeight(), 0); - printAWTTiles.renderer.attachToAutoDrawable(printGLAD); + printAWTTiles.renderer.attachAutoDrawable(printGLAD); if( DEBUG ) { System.err.println("AWT print.setup "+printAWTTiles); System.err.println("AWT print.setup AA "+printNumSamples+", "+caps); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java index 05332c614..811e91886 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java @@ -1,7 +1,9 @@ package com.jogamp.opengl.test.junit.jogl.demos.es1; import com.jogamp.common.nio.Buffers; + import java.nio.*; + import javax.media.opengl.*; import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.fixedfunc.GLPointerFunc; @@ -10,7 +12,7 @@ import com.jogamp.opengl.JoglVersion; import com.jogamp.opengl.util.TileRendererBase; import com.jogamp.opengl.util.glsl.fixedfunc.*; -public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRendererNotify { +public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRendererListener { public static boolean oneThread = false; public static boolean useAnimator = false; @@ -37,15 +39,26 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende this.swapInterval = 1; } + @Override public void addTileRendererNotify(TileRendererBase tr) { tileRendererInUse = tr; doRotateBeforePrinting = doRotate; setDoRotation(false); } + @Override public void removeTileRendererNotify(TileRendererBase tr) { tileRendererInUse = null; setDoRotation(doRotateBeforePrinting); } + @Override + public void startTileRendering(TileRendererBase tr) { + System.err.println("RedSquareES1.startTileRendering: "+tr); + } + @Override + public void endTileRendering(TileRendererBase tr) { + System.err.println("RedSquareES1.endTileRendering: "+tr); + } + public void setDoRotation(boolean rotate) { this.doRotate = rotate; } public void setForceFFPEmu(boolean forceFFPEmu, boolean verboseFFPEmu, boolean debugFFPEmu, boolean traceFFPEmu) { this.forceFFPEmu = forceFFPEmu; @@ -64,6 +77,7 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende private FloatBuffer colors; private FloatBuffer vertices; + @Override public void init(GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" RedSquareES1.init ..."); GL _gl = drawable.getGL(); @@ -122,33 +136,31 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende System.err.println(Thread.currentThread()+" RedSquareES1.init FIN"); } + @Override public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { - System.err.println(Thread.currentThread()+" RedSquareES1.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(glad.getHandle())+", tileRendererInUse "+tileRendererInUse); - GL2ES1 gl = glad.getGL().getGL2ES1(); - gl.setSwapInterval(swapInterval); + final GL2ES1 gl = glad.getGL().getGL2ES1(); + if(-1 != swapInterval) { + gl.setSwapInterval(swapInterval); + } + reshapeImpl(gl, x, y, width, height, width, height); + } + + @Override + public void reshapeTile(TileRendererBase tr, + int tileX, int tileY, int tileWidth, int tileHeight, + int imageWidth, int imageHeight) { + final GL2ES1 gl = tr.getAttachedDrawable().getGL().getGL2ES1(); + gl.setSwapInterval(0); + reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight); + } + + void reshapeImpl(GL2ES1 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) { + System.err.println(Thread.currentThread()+" RedSquareES1.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", tileRendererInUse "+tileRendererInUse); // Set location in front of camera gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); - final int tileWidth = width; - final int tileHeight = height; - final int tileX, tileY, imageWidth, imageHeight; - if( null == tileRendererInUse ) { - if(-1 != swapInterval) { - gl.setSwapInterval(swapInterval); - } - tileX = 0; - tileY = 0; - imageWidth = width; - imageHeight = height; - } else { - gl.setSwapInterval(0); - tileX = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS); - tileY = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS); - imageWidth = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_WIDTH); - imageHeight = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_HEIGHT); - } // compute projection parameters 'normal' perspective final float fovy=45f; final float aspect2 = ( (float) imageWidth / (float) imageHeight ) / aspect; @@ -174,6 +186,7 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende System.err.println(Thread.currentThread()+" RedSquareES1.reshape FIN"); } + @Override public void display(GLAutoDrawable drawable) { curTime = System.currentTimeMillis(); GL2ES1 gl = drawable.getGL().getGL2ES1(); @@ -202,6 +215,7 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende gl.glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY); } + @Override public void dispose(GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" RedSquareES1.dispose ... "); GL2ES1 gl = drawable.getGL().getGL2ES1(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java index 273d5c4e9..bea761a35 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java @@ -34,6 +34,7 @@ import com.jogamp.opengl.util.TileRendererBase; import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; import com.jogamp.opengl.util.glsl.ShaderState; + import java.nio.FloatBuffer; import javax.media.nativewindow.NativeWindow; @@ -49,7 +50,7 @@ import javax.media.opengl.GLUniformData; * GearsES2.java <BR> * @author Brian Paul (converted to Java by Ron Cemer and Sven Gothel) <P> */ -public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererNotify { +public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererListener { private final FloatBuffer lightPos = Buffers.newDirectFloatBuffer( new float[] { 5.0f, 5.0f, 10.0f } ); private ShaderState st = null; @@ -84,15 +85,25 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererN this.swapInterval = 1; } + @Override public void addTileRendererNotify(TileRendererBase tr) { tileRendererInUse = tr; doRotateBeforePrinting = doRotate; setDoRotation(false); } + @Override public void removeTileRendererNotify(TileRendererBase tr) { tileRendererInUse = null; setDoRotation(doRotateBeforePrinting); } + @Override + public void startTileRendering(TileRendererBase tr) { + System.err.println("GearsES2.startTileRendering: "+tr); + } + @Override + public void endTileRendering(TileRendererBase tr) { + System.err.println("GearsES2.endTileRendering: "+tr); + } public void setIgnoreFocus(boolean v) { ignoreFocus = v; } public void setDoRotation(boolean rotate) { this.doRotate = rotate; } @@ -136,6 +147,7 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererN public GearsObjectES2 getGear3() { return gear3; } + @Override public void init(GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" GearsES2.init: tileRendererInUse "+tileRendererInUse); final GL2ES2 gl = drawable.getGL().getGL2ES2(); @@ -233,18 +245,29 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererN System.err.println(Thread.currentThread()+" GearsES2.init FIN"); } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - final GL2ES2 gl = drawable.getGL().getGL2ES2(); + @Override + public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { + final GL2ES2 gl = glad.getGL().getGL2ES2(); + if(-1 != swapInterval) { + gl.setSwapInterval(swapInterval); + } + reshapeImpl(gl, x, y, width, height, width, height); + } + + @Override + public void reshapeTile(TileRendererBase tr, + int tileX, int tileY, int tileWidth, int tileHeight, + int imageWidth, int imageHeight) { + final GL2ES2 gl = tr.getAttachedDrawable().getGL().getGL2ES2(); + gl.setSwapInterval(0); + reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight); + } + + void reshapeImpl(GL2ES2 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) { final boolean msaa = gl.getContext().getGLDrawable().getChosenGLCapabilities().getSampleBuffers(); - System.err.println(Thread.currentThread()+" GearsES2.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(drawable.getHandle())+", msaa "+msaa+", tileRendererInUse "+tileRendererInUse); - - drawableHeight = height; + System.err.println(Thread.currentThread()+" GearsES2.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", msaa "+msaa+", tileRendererInUse "+tileRendererInUse); + drawableHeight = imageHeight; - // Thread.dumpStack(); - - if(-1 != swapInterval) { - gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there) - } if( !gl.hasGLSL() ) { return; } @@ -253,23 +276,6 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererN pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - final int tileWidth = width; - final int tileHeight = height; - final int tileX, tileY, imageWidth, imageHeight; - if( null == tileRendererInUse ) { - gl.setSwapInterval(swapInterval); - tileX = 0; - tileY = 0; - imageWidth = width; - imageHeight = height; - } else { - gl.setSwapInterval(0); - tileX = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS); - tileY = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS); - imageWidth = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_WIDTH); - imageHeight = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_HEIGHT); - } - // compute projection parameters 'normal' float left, right, bottom, top; if( imageHeight > imageWidth ) { @@ -312,6 +318,7 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererN } // private boolean useAndroidDebug = false; + @Override public void dispose(GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" GearsES2.dispose: tileRendererInUse "+tileRendererInUse); final Object upstreamWidget = drawable.getUpstreamWidget(); @@ -339,6 +346,7 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererN System.err.println(Thread.currentThread()+" GearsES2.dispose FIN"); } + @Override public void display(GLAutoDrawable drawable) { GLAnimatorControl anim = drawable.getAnimator(); if( verbose && ( null == anim || !anim.isAnimating() ) ) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java index 40e9876ea..715a97d63 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java @@ -34,13 +34,14 @@ import com.jogamp.opengl.util.TileRendererBase; import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; import com.jogamp.opengl.util.glsl.ShaderState; + import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLUniformData; -public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRendererNotify { +public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRendererListener { private ShaderState st; private PMVMatrix pmvMatrix; private GLUniformData pmvMatrixUniform; @@ -62,19 +63,31 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende this.swapInterval = 1; } + @Override public void addTileRendererNotify(TileRendererBase tr) { tileRendererInUse = tr; doRotateBeforePrinting = doRotate; setDoRotation(false); } + @Override public void removeTileRendererNotify(TileRendererBase tr) { tileRendererInUse = null; setDoRotation(doRotateBeforePrinting); } + @Override + public void startTileRendering(TileRendererBase tr) { + System.err.println("RedSquareES2.startTileRendering: "+tr); + } + @Override + public void endTileRendering(TileRendererBase tr) { + System.err.println("RedSquareES2.endTileRendering: "+tr); + } + public void setAspect(float aspect) { this.aspect = aspect; } public void setDoRotation(boolean rotate) { this.doRotate = rotate; } public void setClearBuffers(boolean v) { clearBuffers = v; } + @Override public void init(GLAutoDrawable glad) { System.err.println(Thread.currentThread()+" RedSquareES2.init: tileRendererInUse "+tileRendererInUse); final GL2ES2 gl = glad.getGL().getGL2ES2(); @@ -138,6 +151,7 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende System.err.println(Thread.currentThread()+" RedSquareES2.init FIN"); } + @Override public void display(GLAutoDrawable glad) { long t1 = System.currentTimeMillis(); @@ -174,10 +188,27 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende st.useProgram(gl, false); } + @Override public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { - System.err.println(Thread.currentThread()+" RedSquareES2.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(glad.getHandle())+", tileRendererInUse "+tileRendererInUse); - // Thread.dumpStack(); final GL2ES2 gl = glad.getGL().getGL2ES2(); + if(-1 != swapInterval) { + gl.setSwapInterval(swapInterval); + } + reshapeImpl(gl, x, y, width, height, width, height); + } + + @Override + public void reshapeTile(TileRendererBase tr, + int tileX, int tileY, int tileWidth, int tileHeight, + int imageWidth, int imageHeight) { + final GL2ES2 gl = tr.getAttachedDrawable().getGL().getGL2ES2(); + gl.setSwapInterval(0); + reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight); + } + + void reshapeImpl(GL2ES2 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) { + System.err.println(Thread.currentThread()+" RedSquareES2.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", tileRendererInUse "+tileRendererInUse); + // Thread.dumpStack(); if( !gl.hasGLSL() ) { return; } @@ -187,24 +218,6 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - final int tileWidth = width; - final int tileHeight = height; - final int tileX, tileY, imageWidth, imageHeight; - if( null == tileRendererInUse ) { - if(-1 != swapInterval) { - gl.setSwapInterval(swapInterval); - } - tileX = 0; - tileY = 0; - imageWidth = width; - imageHeight = height; - } else { - gl.setSwapInterval(0); - tileX = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS); - tileY = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS); - imageWidth = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_WIDTH); - imageHeight = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_HEIGHT); - } // compute projection parameters 'normal' perspective final float fovy=45f; final float aspect2 = ( (float) imageWidth / (float) imageHeight ) / aspect; @@ -233,6 +246,7 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende System.err.println(Thread.currentThread()+" RedSquareES2.reshape FIN"); } + @Override public void dispose(GLAutoDrawable glad) { System.err.println(Thread.currentThread()+" RedSquareES2.dispose: tileRendererInUse "+tileRendererInUse); final GL2ES2 gl = glad.getGL().getGL2ES2(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java index 110dfb779..74089c2fd 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java @@ -26,7 +26,7 @@ import com.jogamp.opengl.util.TileRendererBase; * * This version is equal to Brian Paul's version 1.2 1999/10/21 */ -public class Gears implements GLEventListener, TileRendererBase.TileRendererNotify { +public class Gears implements GLEventListener, TileRendererBase.TileRendererListener { private float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f; private int gear1=0, gear2=0, gear3=0; private float angle = 0.0f; @@ -49,15 +49,25 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererNoti this.swapInterval = 1; } + @Override public void addTileRendererNotify(TileRendererBase tr) { tileRendererInUse = tr; doRotateBeforePrinting = doRotate; setDoRotation(false); } + @Override public void removeTileRendererNotify(TileRendererBase tr) { tileRendererInUse = null; setDoRotation(doRotateBeforePrinting); } + @Override + public void startTileRendering(TileRendererBase tr) { + System.err.println("Gears.startTileRendering: "+tr); + } + @Override + public void endTileRendering(TileRendererBase tr) { + System.err.println("Gears.endTileRendering: "+tr); + } public void setDoRotation(boolean rotate) { doRotate = rotate; } public void setVerbose(boolean v) { verbose = v; } @@ -83,6 +93,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererNoti */ public int getGear3() { return gear3; } + @Override public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); @@ -154,14 +165,31 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererNoti gl.glEnable(GL2.GL_NORMALIZE); } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - GL2 gl = drawable.getGL().getGL2(); - this.reshape(gl, x, y, width, height); + @Override + public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { + final GL2 gl = glad.getGL().getGL2(); + if(-1 != swapInterval) { + gl.setSwapInterval(swapInterval); + } + reshapeImpl(gl, x, y, width, height, width, height); } - + public void reshape(GL2 gl, int x, int y, int width, int height) { + reshapeImpl(gl, x, y, width, height, width, height); + } + + @Override + public void reshapeTile(TileRendererBase tr, + int tileX, int tileY, int tileWidth, int tileHeight, + int imageWidth, int imageHeight) { + final GL2 gl = tr.getAttachedDrawable().getGL().getGL2(); + gl.setSwapInterval(0); + reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight); + } + + void reshapeImpl(GL2 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) { final boolean msaa = gl.getContext().getGLDrawable().getChosenGLCapabilities().getSampleBuffers(); - System.err.println("Gears: Reshape "+x+"/"+y+" "+width+"x"+height+", msaa "+msaa+", tileRendererInUse "+tileRendererInUse); + System.err.println(Thread.currentThread()+" Gears.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", msaa "+msaa+", tileRendererInUse "+tileRendererInUse); if( msaa ) { gl.glEnable(GL.GL_MULTISAMPLE); @@ -171,23 +199,6 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererNoti gl.glLoadIdentity(); - final int tileWidth = width; - final int tileHeight = height; - final int tileX, tileY, imageWidth, imageHeight; - if( null == tileRendererInUse ) { - gl.setSwapInterval(swapInterval); - tileX = 0; - tileY = 0; - imageWidth = width; - imageHeight = height; - } else { - gl.setSwapInterval(0); - tileX = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS); - tileY = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS); - imageWidth = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_WIDTH); - imageHeight = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_HEIGHT); - } - // compute projection parameters 'normal' float left, right, bottom, top; if( imageHeight > imageWidth ) { @@ -228,6 +239,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererNoti } } + @Override public void dispose(GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" Gears.dispose: tileRendererInUse "+tileRendererInUse); try { @@ -241,6 +253,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererNoti setGears(0, 0, 0); } + @Override public void display(GLAutoDrawable drawable) { // Get the GL corresponding to the drawable we are animating GL2 gl = drawable.getGL().getGL2(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java index 09817a27f..d539b5e55 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java @@ -107,7 +107,7 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase { // Initialize the tile rendering library final RandomTileRenderer renderer = new RandomTileRenderer(); - renderer.attachToAutoDrawable(glad); + renderer.attachAutoDrawable(glad); renderer.setImageSize(imageWidth, imageHeight); final GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider = GLPixelBuffer.defaultProviderWithRowStride; @@ -146,7 +146,7 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase { } } - renderer.detachFromAutoDrawable(); + renderer.detachAutoDrawable(); // Restore viewport and Gear's PMV matrix // .. even though we close the demo, this is for documentation! diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java index 16f11d85b..7d3f1f622 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java @@ -196,7 +196,7 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase { } catch (IOException e) { e.printStackTrace(); } - renderer.detachFromAutoDrawable(); + renderer.detachAutoDrawable(); System.err.println("XXX post-display detached: "+renderer); drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); glad.getGLEventListener(0).reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight()); @@ -224,7 +224,7 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase { signalTileRenderer = false; // tile rendering ! System.err.println("XXX START TILE RENDERING"); - renderer.attachToAutoDrawable(glad); + renderer.attachAutoDrawable(glad); } Thread.sleep(100); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java index 26ac34d5a..f0819a43d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java @@ -188,7 +188,7 @@ public class TestTiledRendering2NEWT extends UITestCase { final TileRenderer renderer = new TileRenderer(); renderer.setImageSize(imageWidth, imageHeight); renderer.setTileSize(glad.getWidth(), glad.getHeight(), 0); - renderer.attachToAutoDrawable(glad); + renderer.attachAutoDrawable(glad); final GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider = GLPixelBuffer.defaultProviderWithRowStride; final boolean[] flipVertically = { false }; @@ -219,7 +219,7 @@ public class TestTiledRendering2NEWT extends UITestCase { renderer.display(); } while ( !renderer.eot() ); - renderer.detachFromAutoDrawable(); + renderer.detachAutoDrawable(); // Restore viewport and Gear's PMV matrix // .. even though we close the demo, this is for documentation! |