com.jogamp.opengl.util

## Class RandomTileRenderer

- java.lang.Object
- - com.jogamp.opengl.util.TileRendererBase
  - - com.jogamp.opengl.util.RandomTileRenderer

-     public class RandomTileRenderer
      extends TileRendererBase

  Variation of `TileRenderer` w/o using fixed tiles but arbitrary rectangular regions.

  See `TileRendererBase` for details.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.jogamp.opengl.util.TileRendererBase

      `TileRendererBase.TileRendererListener`

  - ### Field Summary

    - ### 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
    Constructor and Description
    `RandomTileRenderer()` Creates a new TileRenderer object

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beginTile(GL gl)` Begins rendering a tile.
    `void` | `display(int tX, int tY, int tWidth, int tHeight)` Rendering one tile, by simply calling `GLAutoDrawable.display()`.
    `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.
    `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` | `setTileRect(int tX, int tY, int tWidth, int tHeight)` Set the tile rectangle for the subsequent rendering calls.

    - ### Methods inherited from class com.jogamp.opengl.util.TileRendererBase

      `attachAutoDrawable, detachAutoDrawable, display, getAttachedDrawable, getImageBuffer, getImageSize, getTileBuffer, reqPreSwapBuffers, setGLEventListener, setImageBuffer, setImageSize, setTileBuffer, toString, toString`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### RandomTileRenderer

          public RandomTileRenderer()

      Creates a new TileRenderer object

  - ### Method Detail

    - #### getParam

          public final int getParam(int pname)

      Description copied from class: `TileRendererBase`
      Gets the parameters of this TileRenderer object
      Specified by:
        `getParam` in class `TileRendererBase`
      Parameters:
        `pname` - The parameter name that is to be retrieved
      Returns:
        the value of the parameter

    - #### setTileRect

          public void setTileRect(int tX,
                         int tY,
                         int tWidth,
                         int tHeight)
                           throws IllegalStateException,
                                  IllegalArgumentException

      Set the tile rectangle for the subsequent rendering calls.
      Throws:
        `IllegalArgumentException` - is tile x/y are < 0 or tile size is <= 0x0
        `IllegalStateException`

    - #### 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 for `TileRendererBase.beginTile(GL)`. Otherwise returns false.
      Specified by:
        `isSetup` in class `TileRendererBase`

    - #### 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 calling `TileRendererBase.beginTile(GL)` again.

      end of tiling is never reached w/ `RandomRileRenderer`, i.e. method always returns false.

      Specified by:
        `eot` in class `TileRendererBase`

    - #### reset

          public final 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.

      Implementation is a nop where `end of tiling` is never reached.

      Reset internal states of `RandomTileRenderer` are: none.
      Specified by:
        `reset` in class `TileRendererBase`

    - #### beginTile

          public final void beginTile(GL gl)
                               throws IllegalStateException,
                                      GLException

      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
        - x 0
        - y 0
        - `current tile's width`
        - `current tile's height`
      - `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.

      Specified by:
        `beginTile` in class `TileRendererBase`
      Parameters:
        `gl` - The gl context
      Throws:
        `IllegalStateException` - if `image-size` has not been set or `tile-rect` has not been set.
        `GLException` - if `image buffer` is used but `gl` instance is < `GL2ES3`
      See Also:
        `TileRendererBase.isSetup()`, `TileRendererBase.eot()`, `TileRendererBase.reset()`

    - #### endTile

          public void endTile(GL gl)
                       throws IllegalStateException,
                              GLException

      Description copied from class: `TileRendererBase`
      Must be called after rendering the scene, see `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.

      Specified by:
        `endTile` in class `TileRendererBase`
      Parameters:
        `gl` - the gl context
      Throws:
        `IllegalStateException` - if beginTile(gl) has not been called
        `GLException` - if `image buffer` is used but `gl` instance is < `GL2ES3`

    - #### display

          public void display(int tX,
                     int tY,
                     int tWidth,
                     int tHeight)
                       throws IllegalStateException

      Rendering one tile, by simply calling `GLAutoDrawable.display()`.
      Throws:
        `IllegalStateException` - if no `GLAutoDrawable` is `attached` or imageSize is not set

Copyright 2010 JogAmp Community.