public class GLReadBufferUtil extends Object
May be used directly to write the TextureData to file (screenshot).
Constructor and Description |
---|
GLReadBufferUtil(boolean alpha,
boolean write2Texture) |
GLReadBufferUtil(GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider,
boolean alpha,
boolean write2Texture) |
Modifier and Type | Method and Description |
---|---|
void |
dispose(GL gl) |
GLPixelStorageModes |
getGLPixelStorageModes() |
GLPixelBuffer |
getPixelBuffer()
Returns the
GLPixelBuffer , created and filled by #readPixels(GLAutoDrawable, boolean) . |
GLPixelBuffer.GLPixelBufferProvider |
getPixelBufferProvider()
Returns the
GLPixelBuffer.GLPixelBufferProvider used by this instance. |
Texture |
getTexture() |
TextureData |
getTextureData() |
boolean |
hasAlpha() |
boolean |
isValid() |
boolean |
readPixels(GL gl,
boolean mustFlipVertically)
Read the drawable's pixels to TextureData and Texture, if requested at construction.
|
boolean |
readPixels(GL gl,
int inX,
int inY,
int inWidth,
int inHeight,
boolean mustFlipVertically)
Read the drawable's pixels to TextureData and Texture, if requested at construction.
|
void |
rewindPixelBuffer()
rewind the raw pixel ByteBuffer
|
void |
write(File dest)
Write the TextureData filled by
#readPixels(GLAutoDrawable, boolean) to file |
public GLReadBufferUtil(boolean alpha, boolean write2Texture)
alpha
- true for RGBA readPixels, otherwise RGB readPixels. Disclaimer: Alpha maybe forced on ES platforms!write2Texture
- true if readPixel's TextureData shall be written to a 2d Texturepublic GLReadBufferUtil(GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider, boolean alpha, boolean write2Texture)
public GLPixelBuffer.GLPixelBufferProvider getPixelBufferProvider()
GLPixelBuffer.GLPixelBufferProvider
used by this instance.public boolean isValid()
public boolean hasAlpha()
public GLPixelStorageModes getGLPixelStorageModes()
public GLPixelBuffer getPixelBuffer()
GLPixelBuffer
, created and filled by #readPixels(GLAutoDrawable, boolean)
.public void rewindPixelBuffer()
public TextureData getTextureData()
#readPixels(GLAutoDrawable, boolean)
public Texture getTexture()
#readPixels(GLAutoDrawable, boolean)
,
if this instance writes to a 2d Texture, otherwise null.GLReadBufferUtil(boolean, boolean)
public void write(File dest)
#readPixels(GLAutoDrawable, boolean)
to filepublic boolean readPixels(GL gl, boolean mustFlipVertically)
gl
- the current GL context object. It's read drawable is being used as the pixel source.mustFlipVertically
- indicates whether to flip the data vertically or not.
The context's drawable GLDrawable.isGLOriented()
state
is taken into account.
Vertical flipping is propagated to TextureData
and handled in a efficient manner there (TextureCoordinates and TextureIO writer).GLReadBufferUtil(boolean, boolean)
public boolean readPixels(GL gl, int inX, int inY, int inWidth, int inHeight, boolean mustFlipVertically)
gl
- the current GL context object. It's read drawable is being used as the pixel source.inX
- readPixel x offsetinY
- readPixel y offsetinWidth
- optional readPixel width value, used if [1 .. drawable.width], otherwise using drawable.widthinHeight
- optional readPixel height, used if [1 .. drawable.height], otherwise using drawable.heightmustFlipVertically
- indicates whether to flip the data vertically or not.
The context's drawable GLDrawable.isGLOriented()
state
is taken into account.
Vertical flipping is propagated to TextureData
and handled in a efficient manner there (TextureCoordinates and TextureIO writer).GLReadBufferUtil(boolean, boolean)
public void dispose(GL gl)
Copyright 2010 JogAmp Community.