Class TileRenderer
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.
- Author:
- ryanm, sgothel
-
Nested Class Summary
Nested classes/interfaces inherited from class com.jogamp.opengl.util.TileRendererBase
TileRendererBase.TileRendererListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Indicates we are traversing rows from the bottom to the top (default).static final int
The number of columns of tiles.static final int
The current column number.static final int
The current row number.static final int
The current tile number.static final int
The height of the final clipped image.static final int
The width of the final clipped image.static final int
The order that the rows are traversed.static final int
The number of rows of tiles.static final int
The width of the border around the tiles.static final int
The height of the tiles.static final int
The width of the tiles.static final int
The tiles x-offset.static final int
The tiles y-offset.static final int
Indicates we are traversing rows from the top to the bottom.Fields inherited from class com.jogamp.opengl.util.TileRendererBase
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Begins rendering a tile.final void
clipImageSize
(int width, int height) Clips the image-size this tile-renderer iterates through, which can be retrieved viagetClippedImageSize()
.void
Must be called after rendering the scene, seeTileRendererBase.beginTile(GL)
.final boolean
eot()
Returns true if end of tiling has been reached, otherwise false.final DimensionImmutable
Returns the clipped image-size.final int
getParam
(int pname) Gets the parameters of this TileRenderer objectfinal boolean
isSetup()
Returns true if this instance is setup properly, i.e.final void
reset()
Method resets implementation's internal state to start of tiling as required forTileRendererBase.beginTile(GL)
ifend of tiling
has been reached.final void
setImageSize
(int width, int height) Sets the desired size of the final imagefinal void
setRowOrder
(int order) Sets the order of row traversal, default isTR_BOTTOM_TO_TOP
.void
setTileOffset
(int xoff, int yoff) final void
setTileSize
(int width, int height, int border) Sets the size of the tiles to use in rendering.Methods inherited from class com.jogamp.opengl.util.TileRendererBase
attachAutoDrawable, detachAutoDrawable, display, getAttachedDrawable, getImageBuffer, getImageSize, getTileBuffer, reqPreSwapBuffers, setGLEventListener, setImageBuffer, setTileBuffer, toString, toString
-
Field Details
-
TR_IMAGE_CLIPPING_WIDTH
public static final int TR_IMAGE_CLIPPING_WIDTHThe width of the final clipped image. SeegetParam(int)
.- See Also:
-
TR_IMAGE_CLIPPING_HEIGHT
public static final int TR_IMAGE_CLIPPING_HEIGHTThe height of the final clipped image. SeegetParam(int)
.- See Also:
-
TR_TILE_WIDTH
public static final int TR_TILE_WIDTHThe width of the tiles. SeegetParam(int)
.- See Also:
-
TR_TILE_HEIGHT
public static final int TR_TILE_HEIGHTThe height of the tiles. SeegetParam(int)
.- See Also:
-
TR_TILE_BORDER
public static final int TR_TILE_BORDERThe width of the border around the tiles. SeegetParam(int)
.- See Also:
-
TR_TILE_X_OFFSET
public static final int TR_TILE_X_OFFSETThe tiles x-offset. SeegetParam(int)
.- See Also:
-
TR_TILE_Y_OFFSET
public static final int TR_TILE_Y_OFFSETThe tiles y-offset. SeegetParam(int)
.- See Also:
-
TR_ROWS
public static final int TR_ROWSThe number of rows of tiles. SeegetParam(int)
.- See Also:
-
TR_COLUMNS
public static final int TR_COLUMNSThe number of columns of tiles. SeegetParam(int)
.- See Also:
-
TR_CURRENT_TILE_NUM
public static final int TR_CURRENT_TILE_NUMThe current tile number. Has value -1 ifeot()
. SeegetParam(int)
.- See Also:
-
TR_CURRENT_ROW
public static final int TR_CURRENT_ROWThe current row number. SeegetParam(int)
.- See Also:
-
TR_CURRENT_COLUMN
public static final int TR_CURRENT_COLUMNThe current column number. SeegetParam(int)
.- See Also:
-
TR_ROW_ORDER
public static final int TR_ROW_ORDERThe order that the rows are traversed. SeegetParam(int)
.- See Also:
-
TR_TOP_TO_BOTTOM
public static final int TR_TOP_TO_BOTTOMIndicates we are traversing rows from the top to the bottom. SeegetParam(int)
.- See Also:
-
TR_BOTTOM_TO_TOP
public static final int TR_BOTTOM_TO_TOPIndicates we are traversing rows from the bottom to the top (default). SeegetParam(int)
.- See Also:
-
-
Constructor Details
-
TileRenderer
public TileRenderer()Creates a new TileRenderer object
-
-
Method Details
-
setImageSize
public final void setImageSize(int width, int height) Sets the desired size of the final imageImplementation
reset()
internal states.- Overrides:
setImageSize
in classTileRendererBase
- Parameters:
width
- The width of the final imageheight
- The height of the final image
-
clipImageSize
public final void clipImageSize(int width, int height) Clips the image-size this tile-renderer iterates through, which can be retrieved viagetClippedImageSize()
.Original image-size stored in this tile-renderer is unmodified.
Implementation
reset()
internal states.- Parameters:
width
- The image-clipping.widthheight
- The image-clipping.height- See Also:
-
getClippedImageSize
Returns the clipped image-size.If a image-size is clipped via
clipImageSize(int, int)
, method returns:min( image-clipping, image-size )
, otherwiseimage-size
The clipping width and height can be retrieved via
TR_IMAGE_CLIPPING_WIDTH
TR_IMAGE_CLIPPING_HEIGHT
. -
setTileSize
public final void setTileSize(int width, int height, int border) Sets the size of the tiles to use in rendering. The actual effective size of the tile depends on the border size, ie ( width - 2*border ) * ( height - 2 * border )Implementation
reset()
internal states.- Parameters:
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.
-
setTileOffset
public void setTileOffset(int xoff, int yoff) - See Also:
-
reset
public final void reset()Method resets implementation's internal state to start of tiling as required forTileRendererBase.beginTile(GL)
ifend of tiling
has been reached.Implementation is a nop where
Reset internal states ofend of tiling
is never reached.TileRenderer
are:- Specified by:
reset
in classTileRendererBase
-
getParam
public final int getParam(int pname) Description copied from class:TileRendererBase
Gets the parameters of this TileRenderer object- Specified by:
getParam
in classTileRendererBase
- Parameters:
pname
- The parameter name that is to be retrieved- Returns:
- the value of the parameter
-
setRowOrder
public final void setRowOrder(int order) Sets the order of row traversal, default isTR_BOTTOM_TO_TOP
.- Parameters:
order
- The row traversal order, must be eitherTR_TOP_TO_BOTTOM
orTR_BOTTOM_TO_TOP
.
-
isSetup
public final boolean isSetup()Description copied from class:TileRendererBase
Returns true if this instance is setup properly, i.e.TileRendererBase.setImageSize(int, int)
.., and ready forTileRendererBase.beginTile(GL)
. Otherwise returns false.- Specified by:
isSetup
in classTileRendererBase
-
eot
public final boolean eot()Returns true if end of tiling has been reached, otherwise false.end of tiling criteria is implementation specific and may never be reached.
User needs to
TileRendererBase.reset()
tiling after reaching end of tiling before callingTileRendererBase.beginTile(GL)
again.end of tiling is reached w/
TileRenderer
, if at least one of the following is true:- all tiles have been rendered, i.e.
TR_CURRENT_TILE_NUM
is -1 - no tiles to render, i.e.
TR_COLUMNS
orTR_ROWS
is 0
- Specified by:
eot
in classTileRendererBase
- all tiles have been rendered, i.e.
-
beginTile
Begins rendering a tile.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 Viewport
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 toTileRendererBase.reset()
tiling before calling this method.- Specified by:
beginTile
in classTileRendererBase
- Parameters:
gl
- The gl context- Throws:
IllegalStateException
- ifimage-size
has not been set orend-of-tiling
has been reached.GLException
- ifimage buffer
is used butgl
instance is <GL2ES3
- See Also:
-
endTile
Description copied from class:TileRendererBase
Must be called after rendering the scene, seeTileRendererBase.beginTile(GL)
.Please consider
TileRendererBase.reqPreSwapBuffers(GLCapabilitiesImmutable)
to determine whether you need to performswap-buffers
before or after calling this method!User has to comply with the GL profile requirement.
- Specified by:
endTile
in classTileRendererBase
- Parameters:
gl
- the gl context- Throws:
IllegalStateException
- if beginTile(gl) has not been calledGLException
- ifimage buffer
is used butgl
instance is <GL2ES3
-