diff options
Diffstat (limited to 'src/jogl')
3 files changed, 24 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java index dcf229716..8fc7916c7 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java @@ -89,6 +89,11 @@ public class RandomTileRenderer extends TileRendererBase { tileRectSet = true; } + @Override + public final boolean isSetup() { + return 0 < imageSize.getWidth() && 0 < imageSize.getHeight() && tileRectSet; + } + /** * {@inheritDoc} * @throws IllegalStateException if image-size or tileRect has not been set diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java index 7c57627e9..f126eb7f5 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java @@ -337,8 +337,13 @@ public class TileRenderer extends TileRendererBase { } @Override + public final boolean isSetup() { + return 0 < imageSize.getWidth() && 0 < imageSize.getHeight(); + } + + @Override public final void beginTile( GL gl ) throws IllegalStateException, GLException { - if( 0 >= imageSize.getWidth() || 0 >= imageSize.getHeight() ) { + if( !isSetup() ) { throw new IllegalStateException("Image size has not been set"); } validateGL(gl); diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java index 5b3644f59..f00e59347 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java @@ -313,6 +313,13 @@ public abstract class TileRendererBase { } } + /** + * Returns true if this instance is setup properly, i.e. {@link #setImageSize(int, int)} .., + * and ready for {@link #beginTile(GL)}. + * Otherwise returns false. + */ + public abstract boolean isSetup(); + /** * Begins rendering a tile. * <p> @@ -577,6 +584,12 @@ public abstract class TileRendererBase { } @Override public void display(GLAutoDrawable drawable) { + if( !isSetup() ) { + if( DEBUG ) { + System.err.println("TileRenderer.glel.display: !setup: "+TileRendererBase.this); + } + return; + } if( null != glEventListenerPre ) { glEventListenerPre.reshape(drawable, 0, 0, currentTileWidth, currentTileHeight); glEventListenerPre.display(drawable); |