|
JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java (public API).
|
A fairly direct port of Brian Paul's tile rendering library, found at http://www.mesa3d.org/brianp/TR.html . More...
Classes | |
| interface | TileRendererListener |
Listener for tile renderer events, intended to extend GLEventListener implementations, enabling tile rendering via TileRendererBase#attachAutoDrawable(GLAutoDrawable). More... | |
Public Member Functions | |
| StringBuilder | toString (final StringBuilder sb) |
| String | toString () |
| abstract int | getParam (int pname) throws IllegalArgumentException |
| Gets the parameters of this TileRenderer object. More... | |
| final void | setTileBuffer (final GLPixelBuffer buffer) |
| Specify a buffer the tiles to be copied to. More... | |
| final GLPixelBuffer | getTileBuffer () |
| void | setImageSize (final int width, final int height) |
| Sets the desired size of the final image. More... | |
| final DimensionImmutable | getImageSize () |
| final void | setImageBuffer (final GLPixelBuffer buffer) |
| Sets the buffer in which to store the final image. More... | |
| final GLPixelBuffer | getImageBuffer () |
| abstract boolean | isSetup () |
| Returns true if this instance is setup properly, i.e. More... | |
| abstract boolean | eot () |
| Returns true if end of tiling has been reached, otherwise false. More... | |
| abstract void | reset () |
Method resets implementation's internal state to start of tiling as required for beginTile(GL) if end of tiling has been reached. More... | |
| abstract void | beginTile (GL gl) throws IllegalStateException, GLException |
| Begins rendering a tile. More... | |
| abstract void | endTile (GL gl) throws IllegalStateException, GLException |
Must be called after rendering the scene, see beginTile(GL). More... | |
| final boolean | reqPreSwapBuffers (final GLCapabilitiesImmutable chosenCaps) |
Determines whether the chosen GLCapabilitiesImmutable requires a pre-swap-buffers before accessing the results, i.e. More... | |
| final void | attachAutoDrawable (final GLAutoDrawable glad) throws IllegalStateException |
Attaches the given GLAutoDrawable to this tile renderer. More... | |
| final GLAutoDrawable | getAttachedDrawable () |
Returns a previously attached GLAutoDrawable, null if none is attached. More... | |
| final void | detachAutoDrawable () |
Detaches the given GLAutoDrawable from this tile renderer. More... | |
| final void | setGLEventListener (final GLEventListener preTile, final GLEventListener postTile) |
Set GLEventListener for pre- and post operations when used w/ attachAutoDrawable(GLAutoDrawable) for each GLEventListener callback. More... | |
| final void | display () throws IllegalStateException |
Rendering one tile, by simply calling GLAutoDrawable#display(). More... | |
Static Public Attributes | |
| static final int | TR_IMAGE_WIDTH = 1 |
| The width of the final image. More... | |
| static final int | TR_IMAGE_HEIGHT = 2 |
| The height of the final image. More... | |
| static final int | TR_CURRENT_TILE_X_POS = 3 |
| The x-pos of the current tile. More... | |
| static final int | TR_CURRENT_TILE_Y_POS = 4 |
| The y-pos of the current tile. More... | |
| static final int | TR_CURRENT_TILE_WIDTH = 5 |
| The width of the current tile. More... | |
| static final int | TR_CURRENT_TILE_HEIGHT = 6 |
| The height of the current tile. More... | |
Protected Member Functions | |
| StringBuilder | tileDetails (final StringBuilder sb) |
| TileRendererBase () | |
Protected Attributes | |
| final Dimension | imageSize = new Dimension(0, 0) |
| final GLPixelStorageModes | psm = new GLPixelStorageModes() |
| GLPixelBuffer | imageBuffer |
| GLPixelBuffer | tileBuffer |
| boolean | beginCalled = false |
| int | currentTileXPos |
| int | currentTileYPos |
| int | currentTileWidth |
| int | currentTileHeight |
| GLAutoDrawable | glad |
| boolean | gladRequiresPreSwap |
| boolean | gladAutoSwapBufferMode = true |
| GLEventListener[] | listeners |
| boolean[] | listenersInit |
| GLEventListener | glEventListenerPre = null |
| GLEventListener | glEventListenerPost = null |
A fairly direct port of Brian Paul's tile rendering library, found at http://www.mesa3d.org/brianp/TR.html .
I've java-fied it, but the functionality is the same.
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 GL and GL2ES3, abstracted to suit TileRenderer and RandomTileRenderer.
The PMV matrix needs to be reshaped in user code after calling beginTile(GL), See beginTile(GL).
If attaching to an GLAutoDrawable, the TileRendererListener#reshapeTile(TileRendererBase, int, int, int, int, int, int) method is being called after beginTile(GL) for each rendered tile. It's implementation shall reshape the PMV matrix according to beginTile(GL).
Note that image buffer can only be used in conjunction w/ a GL instance ≥ GL2ES3 passed to beginTile(GL) and endTile(GL).
This is due to setting up the pack row length for an image width != tile-width, which usually is the case.
Hence a GLException is thrown in both methods, if using an image buffer and passing a GL instance < GL2ES3.
Further more, reading back of MSAA buffers is only supported since GL2ES3 since it requires to set the read-buffer.
Definition at line 91 of file TileRendererBase.java.
|
protected |
Definition at line 253 of file TileRendererBase.java.
| final void com.jogamp.opengl.util.TileRendererBase.attachAutoDrawable | ( | final GLAutoDrawable | glad | ) | throws IllegalStateException |
Attaches the given GLAutoDrawable to this tile renderer.
The GLAutoDrawable's original GLEventListener are moved to this tile renderer.
GLEventListeners not implementing TileRendererListener are ignored while tile rendering.
The GLAutoDrawable's auto-swap mode is cached and set to false, since swapBuffers() maybe issued before endTile(GL), see reqPreSwapBuffers(GLCapabilitiesImmutable).
This tile renderer's internal GLEventListener is then added to the attached GLAutoDrawable to handle the tile rendering, replacing the original GLEventListener.
It's display implementations issues:
pre-glel.display(..) beginTile(GL) TileRendererListener:
pre-swap ) { swapBuffers() } endTile(GL) pre-swap ) { swapBuffers() } post-glel.display(..) Consider using setGLEventListener(GLEventListener, GLEventListener) to add pre- and post hooks to be performed on this renderer GLEventListener.
The pre-hook is able to allocate memory and setup parameters, since it's called before beginTile(GL).
The post-hook is able to use the rendering result and can even shutdown tile-rendering, since it's called after endTile(GL).
Call detachAutoDrawable() to remove the attached GLAutoDrawable from this tile renderer and to restore it's original GLEventListener.
| glad | the GLAutoDrawable to attach. |
| IllegalStateException | if an GLAutoDrawable is already attached |
Definition at line 468 of file TileRendererBase.java.
|
abstract |
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 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 endTile(GL).
User has to comply with the GL profile requirement.
If end of tiling has been reached, user needs to reset() tiling before calling this method.
| gl | The gl context |
| IllegalStateException | if image-size is undefined, an implementation related setup has not be performed or {@ link eot()} has been reached. See implementing classes. |
| GLException | if image buffer is used but gl instance is < GL2ES3 |
Reimplemented in com.jogamp.opengl.util.RandomTileRenderer, and com.jogamp.opengl.util.TileRenderer.
| final void com.jogamp.opengl.util.TileRendererBase.detachAutoDrawable | ( | ) |
Detaches the given GLAutoDrawable from this tile renderer.
Definition at line 522 of file TileRendererBase.java.
| final void com.jogamp.opengl.util.TileRendererBase.display | ( | ) | throws IllegalStateException |
Rendering one tile, by simply calling GLAutoDrawable#display().
| IllegalStateException | if no GLAutoDrawable is attached or imageSize is not set |
Definition at line 564 of file TileRendererBase.java.
|
abstract |
Must be called after rendering the scene, see beginTile(GL).
Please consider 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.
| gl | the gl context |
| IllegalStateException | if beginTile(gl) has not been called |
| GLException | if image buffer is used but gl instance is < GL2ES3 |
Reimplemented in com.jogamp.opengl.util.RandomTileRenderer, and com.jogamp.opengl.util.TileRenderer.
|
abstract |
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 reset() tiling after reaching end of tiling before calling beginTile(GL) again.
Reimplemented in com.jogamp.opengl.util.RandomTileRenderer, and com.jogamp.opengl.util.TileRenderer.
| final GLAutoDrawable com.jogamp.opengl.util.TileRendererBase.getAttachedDrawable | ( | ) |
Returns a previously attached GLAutoDrawable, null if none is attached.
If called from TileRendererListener#addTileRendererNotify(TileRendererBase) or TileRendererListener#removeTileRendererNotify(TileRendererBase), method returns the just attached or soon to be detached GLAutoDrawable.
Definition at line 513 of file TileRendererBase.java.
| final GLPixelBuffer com.jogamp.opengl.util.TileRendererBase.getImageBuffer | ( | ) |
Definition at line 308 of file TileRendererBase.java.
| final DimensionImmutable com.jogamp.opengl.util.TileRendererBase.getImageSize | ( | ) |
Definition at line 293 of file TileRendererBase.java.
|
abstract |
Gets the parameters of this TileRenderer object.
| pname | The parameter name that is to be retrieved |
| IllegalArgumentException | if pname is not handled |
Reimplemented in com.jogamp.opengl.util.RandomTileRenderer, and com.jogamp.opengl.util.TileRenderer.
| final GLPixelBuffer com.jogamp.opengl.util.TileRendererBase.getTileBuffer | ( | ) |
Definition at line 280 of file TileRendererBase.java.
|
abstract |
Returns true if this instance is setup properly, i.e.
setImageSize(int, int) .., and ready for beginTile(GL). Otherwise returns false.
Reimplemented in com.jogamp.opengl.util.RandomTileRenderer, and com.jogamp.opengl.util.TileRenderer.
| final boolean com.jogamp.opengl.util.TileRendererBase.reqPreSwapBuffers | ( | final GLCapabilitiesImmutable | chosenCaps | ) |
Determines whether the chosen GLCapabilitiesImmutable requires a pre-swap-buffers before accessing the results, i.e.
before endTile(GL).
See GLDrawableUtil#swapBuffersBeforeRead(GLCapabilitiesImmutable).
Definition at line 417 of file TileRendererBase.java.
|
abstract |
Method resets implementation's internal state to start of tiling as required for beginTile(GL) if end of tiling has been reached.
Implementation is a nop where end of tiling is never reached.
Reimplemented in com.jogamp.opengl.util.RandomTileRenderer, and com.jogamp.opengl.util.TileRenderer.
| final void com.jogamp.opengl.util.TileRendererBase.setGLEventListener | ( | final GLEventListener | preTile, |
| final GLEventListener | postTile | ||
| ) |
Set GLEventListener for pre- and post operations when used w/ attachAutoDrawable(GLAutoDrawable) for each GLEventListener callback.
| preTile | the pre operations |
| postTile | the post operations |
Definition at line 553 of file TileRendererBase.java.
| final void com.jogamp.opengl.util.TileRendererBase.setImageBuffer | ( | final GLPixelBuffer | buffer | ) |
Sets the buffer in which to store the final image.
| buffer | the buffer itself, must be large enough to hold the final image |
Definition at line 300 of file TileRendererBase.java.
| void com.jogamp.opengl.util.TileRendererBase.setImageSize | ( | final int | width, |
| final int | height | ||
| ) |
Sets the desired size of the final image.
| width | The width of the final image |
| height | The height of the final image |
Reimplemented in com.jogamp.opengl.util.TileRenderer.
Definition at line 288 of file TileRendererBase.java.
| final void com.jogamp.opengl.util.TileRendererBase.setTileBuffer | ( | final GLPixelBuffer | buffer | ) |
Specify a buffer the tiles to be copied to.
This is not necessary for the creation of the final image, but useful if you want to inspect each tile in turn.
| buffer | The buffer itself. Must be large enough to contain a random tile |
Definition at line 272 of file TileRendererBase.java.
|
protected |
Reimplemented in com.jogamp.opengl.util.TileRenderer.
Definition at line 234 of file TileRendererBase.java.
| String com.jogamp.opengl.util.TileRendererBase.toString | ( | ) |
Definition at line 247 of file TileRendererBase.java.
| StringBuilder com.jogamp.opengl.util.TileRendererBase.toString | ( | final StringBuilder | sb | ) |
|
protected |
Definition at line 217 of file TileRendererBase.java.
|
protected |
Definition at line 221 of file TileRendererBase.java.
|
protected |
Definition at line 220 of file TileRendererBase.java.
|
protected |
Definition at line 218 of file TileRendererBase.java.
|
protected |
Definition at line 219 of file TileRendererBase.java.
|
protected |
Definition at line 222 of file TileRendererBase.java.
|
protected |
Definition at line 224 of file TileRendererBase.java.
|
protected |
Definition at line 223 of file TileRendererBase.java.
|
protected |
Definition at line 228 of file TileRendererBase.java.
|
protected |
Definition at line 227 of file TileRendererBase.java.
|
protected |
Definition at line 215 of file TileRendererBase.java.
Definition at line 213 of file TileRendererBase.java.
|
protected |
Definition at line 225 of file TileRendererBase.java.
|
protected |
Definition at line 226 of file TileRendererBase.java.
|
protected |
Definition at line 214 of file TileRendererBase.java.
|
protected |
Definition at line 216 of file TileRendererBase.java.
|
static |
The height of the current tile.
See getParam(int).
Definition at line 115 of file TileRendererBase.java.
|
static |
The width of the current tile.
See getParam(int).
Definition at line 111 of file TileRendererBase.java.
|
static |
The x-pos of the current tile.
See getParam(int).
Definition at line 103 of file TileRendererBase.java.
|
static |
The y-pos of the current tile.
See getParam(int).
Definition at line 107 of file TileRendererBase.java.
|
static |
The height of the final image.
See getParam(int).
Definition at line 99 of file TileRendererBase.java.
|
static |
The width of the final image.
See getParam(int).
Definition at line 95 of file TileRendererBase.java.