28package com.jogamp.opengl.util;
30import com.jogamp.opengl.GL;
31import com.jogamp.opengl.GL2ES3;
32import com.jogamp.opengl.GLAutoDrawable;
33import com.jogamp.opengl.GLException;
35import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
44 private boolean tileRectSet =
false;
69 throw new IllegalArgumentException(
"Invalid pname: "+pname);
78 public void setTileRect(
final int tX,
final int tY,
final int tWidth,
final int tHeight)
throws IllegalStateException, IllegalArgumentException {
79 if( 0 > tX || 0 > tY ) {
80 throw new IllegalArgumentException(
"Tile pos must be >= 0/0");
82 if( 0 >= tWidth || 0 >= tHeight ) {
83 throw new IllegalArgumentException(
"Tile size must be > 0x0");
85 this.currentTileXPos = tX;
86 this.currentTileYPos = tY;
87 this.currentTileWidth = tWidth;
88 this.currentTileHeight = tHeight;
106 public final boolean eot() {
return false; }
125 throw new IllegalStateException(
"Image size has not been set");
128 throw new IllegalStateException(
"tileRect has not been set");
135 System.err.println(
"TileRenderer.begin.X: "+this.
toString());
148 throw new IllegalStateException(
"beginTile(..) has not been called");
158 final int readBuffer;
159 if( gl.isGL2ES3() ) {
168 System.err.println(
"TileRenderer.end.0: readBuffer 0x"+Integer.toHexString(readBuffer)+
", "+
this.toString());
171 final int tmp[] =
new int[1];
182 throw new IndexOutOfBoundsException(
"Required " + readPixelSize +
" bytes of buffer, only had " +
tileBuffer);
206 final int ibLim = ibPos + readPixelSize;
209 throw new IndexOutOfBoundsException(
"Required " + ibLim +
" bytes of buffer, only had " +
imageBuffer);
232 public void display(
final int tX,
final int tY,
final int tWidth,
final int tHeight)
throws IllegalStateException {
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Utility routines for dealing with direct buffers.
static final int sizeof(final GL gl, final int tmp[], final int bytesPerPixel, int width, int height, int depth, final boolean pack)
Returns the number of bytes required to read/write a memory buffer via OpenGL using the current GL pi...
final int type
The OpenGL pixel data type
final PixelFormat pfmt
PixelFormat describing the component layout
final int format
The OpenGL pixel data format.
int position()
Returns the byte position of the buffer.
Buffer flip()
See Buffer#flip().
final GLPixelAttributes pixelAttributes
The GLPixelAttributes.
Buffer clear()
See Buffer#clear().
boolean requiresNewBuffer(final GL gl, final int newWidth, final int newHeight, int newByteSize)
Returns true, if invalid or implementation requires a new buffer based on the new size due to pixel a...
final Buffer buffer
Buffer holding the pixel data.
final void setPackRowLength(final GL2ES3 gl, final int packRowLength)
Sets the GL2ES3#GL_PACK_ROW_LENGTH.
final void restore(final GL gl)
Restores PACK and UNPACK pixel storage mode previously saved w/ saveAll(GL) or savePack(GL) and saveU...
final void setPackAlignment(final GL gl, final int packAlignment)
Sets the GL#GL_PACK_ALIGNMENT.
Variation of TileRenderer w/o using fixed tiles but arbitrary rectangular regions.
void display(final int tX, final int tY, final int tWidth, final int tHeight)
Rendering one tile, by simply calling GLAutoDrawable#display().
final void reset()
Method resets implementation's internal state to start of tiling as required for beginTile(GL) if end...
final boolean isSetup()
Returns true if this instance is setup properly, i.e.
final boolean eot()
Returns true if end of tiling has been reached, otherwise false.end of tiling criteria is implementat...
void endTile(final GL gl)
Must be called after rendering the scene, see beginTile(GL).
final int getParam(final int pname)
Gets the parameters of this TileRenderer object.
final void beginTile(final GL gl)
Begins rendering a tile.This method modifies the viewport, see below. User shall reset the viewport w...
void setTileRect(final int tX, final int tY, final int tWidth, final int tHeight)
Set the tile rectangle for the subsequent rendering calls.
RandomTileRenderer()
Creates a new TileRenderer object.
A fairly direct port of Brian Paul's tile rendering library, found at http://www.mesa3d....
GLPixelBuffer imageBuffer
static final int TR_CURRENT_TILE_WIDTH
The width of the current tile.
final Dimension imageSize
static final int TR_IMAGE_WIDTH
The width of the final image.
final GLPixelStorageModes psm
static final int TR_CURRENT_TILE_HEIGHT
The height of the current tile.
static final int TR_CURRENT_TILE_X_POS
The x-pos of the current tile.
final void display()
Rendering one tile, by simply calling GLAutoDrawable#display().
static final int TR_CURRENT_TILE_Y_POS
The y-pos of the current tile.
static final int TR_IMAGE_HEIGHT
The height of the final image.
void glReadBuffer(int mode)
Entry point to C language function: void {@native glReadBuffer}(GLenum mode) Part of GL_ES_VERSION...
GL2ES3 getGL2ES3()
Casts this object to the GL2ES3 interface.
int getDefaultReadBuffer()
Returns the default color buffer within the current bound getDefaultReadFramebuffer(),...