public class TileRenderer extends TileRendererBase
Original code Copyright (C) 1997-2005 Brian Paul. Licensed under BSD-compatible terms with permission of the author. See LICENSE.txt for license information.
Enhanced for GL2ES3
.
See TileRendererBase
for details.
TileRendererBase.TileRendererListener
Modifier and Type | Field and Description |
---|---|
static int |
TR_BOTTOM_TO_TOP
Indicates we are traversing rows from the bottom to the top (default).
|
static int |
TR_COLUMNS
The number of columns of tiles.
|
static int |
TR_CURRENT_COLUMN
The current column number.
|
static int |
TR_CURRENT_ROW
The current row number.
|
static int |
TR_CURRENT_TILE_NUM
The current tile number.
|
static int |
TR_IMAGE_CLIPPING_HEIGHT
The height of the final clipped image.
|
static int |
TR_IMAGE_CLIPPING_WIDTH
The width of the final clipped image.
|
static int |
TR_ROW_ORDER
The order that the rows are traversed.
|
static int |
TR_ROWS
The number of rows of tiles.
|
static int |
TR_TILE_BORDER
The width of the border around the tiles.
|
static int |
TR_TILE_HEIGHT
The height of the tiles.
|
static int |
TR_TILE_WIDTH
The width of the tiles.
|
static int |
TR_TILE_X_OFFSET
The tiles x-offset.
|
static int |
TR_TILE_Y_OFFSET
The tiles y-offset.
|
static int |
TR_TOP_TO_BOTTOM
Indicates we are traversing rows from the top to the bottom.
|
TR_CURRENT_TILE_HEIGHT, TR_CURRENT_TILE_WIDTH, TR_CURRENT_TILE_X_POS, TR_CURRENT_TILE_Y_POS, TR_IMAGE_HEIGHT, TR_IMAGE_WIDTH
Constructor and Description |
---|
TileRenderer()
Creates a new TileRenderer object
|
Modifier and Type | Method and Description |
---|---|
void |
beginTile(GL gl)
Begins rendering a tile.
|
void |
clipImageSize(int width,
int height)
Clips the image-size this tile-renderer iterates through,
which can be retrieved via
getClippedImageSize() . |
void |
endTile(GL gl)
Must be called after rendering the scene,
see
TileRendererBase.beginTile(GL) . |
boolean |
eot()
Returns true if end of tiling has been reached, otherwise false.
|
DimensionImmutable |
getClippedImageSize()
Returns the clipped image-size.
|
int |
getParam(int pname)
Gets the parameters of this TileRenderer object
|
boolean |
isSetup()
Returns true if this instance is setup properly, i.e.
|
void |
reset()
Method resets implementation's internal state to start of tiling
as required for
TileRendererBase.beginTile(GL) if end of tiling has been reached. |
void |
setImageSize(int width,
int height)
Sets the desired size of the final image
|
void |
setRowOrder(int order)
Sets the order of row traversal, default is
TR_BOTTOM_TO_TOP . |
void |
setTileOffset(int xoff,
int yoff)
|
void |
setTileSize(int width,
int height,
int border)
Sets the size of the tiles to use in rendering.
|
attachAutoDrawable, detachAutoDrawable, display, getAttachedDrawable, getImageBuffer, getImageSize, getTileBuffer, reqPreSwapBuffers, setGLEventListener, setImageBuffer, setTileBuffer, toString, toString
public static final int TR_IMAGE_CLIPPING_WIDTH
getParam(int)
.public static final int TR_IMAGE_CLIPPING_HEIGHT
getParam(int)
.public static final int TR_TILE_WIDTH
getParam(int)
.public static final int TR_TILE_HEIGHT
getParam(int)
.public static final int TR_TILE_BORDER
getParam(int)
.public static final int TR_TILE_X_OFFSET
getParam(int)
.public static final int TR_TILE_Y_OFFSET
getParam(int)
.public static final int TR_ROWS
getParam(int)
.public static final int TR_COLUMNS
getParam(int)
.public static final int TR_CURRENT_TILE_NUM
eot()
. See getParam(int)
.public static final int TR_CURRENT_ROW
getParam(int)
.public static final int TR_CURRENT_COLUMN
getParam(int)
.public static final int TR_ROW_ORDER
getParam(int)
.public static final int TR_TOP_TO_BOTTOM
getParam(int)
.public static final int TR_BOTTOM_TO_TOP
getParam(int)
.public final void setImageSize(int width, int height)
Implementation reset()
internal states.
setImageSize
in class TileRendererBase
width
- The width of the final imageheight
- The height of the final imagepublic final void clipImageSize(int width, int height)
getClippedImageSize()
.
Original image-size stored in this tile-renderer is unmodified.
Implementation reset()
internal states.
width
- The image-clipping.widthheight
- The image-clipping.heightgetClippedImageSize()
public final DimensionImmutable getClippedImageSize()
If a image-size is clipped via clipImageSize(int, int)
,
method returns:
min( image-clipping, image-size )
, otherwise image-size
The clipping width and height can be retrieved via TR_IMAGE_CLIPPING_WIDTH
TR_IMAGE_CLIPPING_HEIGHT
.
public final void setTileSize(int width, int height, int border)
Implementation reset()
internal states.
width
- The width of the tiles. Must not be larger than the GL
contextheight
- The height of the tiles. Must not be larger than the
GL contextborder
- The width of the borders on each tile. This is needed
to avoid artifacts when rendering lines or points with
thickness > 1.public void setTileOffset(int xoff, int yoff)
TR_TILE_X_OFFSET
,
TR_TILE_Y_OFFSET
public final void reset()
TileRendererBase.beginTile(GL)
if end of tiling
has been reached.
Implementation is a nop where end of tiling
is never reached.
TileRenderer
are:
reset
in class TileRendererBase
public final int getParam(int pname)
TileRendererBase
getParam
in class TileRendererBase
pname
- The parameter name that is to be retrievedpublic final void setRowOrder(int order)
TR_BOTTOM_TO_TOP
.order
- The row traversal order, must be either TR_TOP_TO_BOTTOM
or TR_BOTTOM_TO_TOP
.public final boolean isSetup()
TileRendererBase
TileRendererBase.setImageSize(int, int)
..,
and ready for TileRendererBase.beginTile(GL)
.
Otherwise returns false.isSetup
in class TileRendererBase
public final boolean eot()
end of tiling criteria is implementation specific and may never be reached.
User needs to TileRendererBase.reset()
tiling after reaching end of tiling
before calling TileRendererBase.beginTile(GL)
again.
end of tiling is reached w/ TileRenderer
, if at least one of the following is true:
TR_CURRENT_TILE_NUM
is -1TR_COLUMNS
or TR_ROWS
is 0eot
in class TileRendererBase
public final void beginTile(GL gl) throws IllegalStateException, GLException
This method modifies the viewport, see below.
User shall reset the viewport when finishing all tile rendering,
i.e. after very last call of TileRendererBase.endTile(GL)
!
The PMV Matrix must be reshaped after this call using:
current tile's x-pos
current tile's y-pos
final image width
final image height
Use shall render the scene afterwards, concluded with a call to
this renderer TileRendererBase.endTile(GL)
.
User has to comply with the GL profile requirement.
If end of tiling
has been reached,
user needs to TileRendererBase.reset()
tiling before calling this method.
beginTile
in class TileRendererBase
gl
- The gl contextIllegalStateException
- if image-size
has not been set or
end-of-tiling
has been reached.GLException
- if image buffer
is used but gl
instance is < GL2ES3
TileRendererBase.isSetup()
,
TileRendererBase.eot()
,
TileRendererBase.reset()
public void endTile(GL gl) throws IllegalStateException, GLException
TileRendererBase
TileRendererBase.beginTile(GL)
.
Please consider TileRendererBase.reqPreSwapBuffers(GLCapabilitiesImmutable)
to determine
whether you need to perform swap-buffers
before or after
calling this method!
User has to comply with the GL profile requirement.
endTile
in class TileRendererBase
gl
- the gl contextIllegalStateException
- if beginTile(gl) has not been calledGLException
- if image buffer
is used but gl
instance is < GL2ES3
Copyright 2010 JogAmp Community.