Package com.jogamp.opengl.util
Class GLReadBufferUtil
java.lang.Object
com.jogamp.opengl.util.GLReadBufferUtil
- Direct Known Subclasses:
AWTGLReadBufferUtil
Utility to read out the current FB to TextureData, optionally writing the data back to a texture object.
May be used directly to write the TextureData to file (screenshot).
-
Constructor Summary
ConstructorsConstructorDescriptionGLReadBufferUtil
(boolean alpha, boolean write2Texture) GLReadBufferUtil
(GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider, boolean alpha, boolean write2Texture) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Returns theGLPixelBuffer
, created and filled by#readPixels(GLAutoDrawable, boolean)
.Returns theGLPixelBuffer.GLPixelBufferProvider
used by this instance.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
rewind the raw pixel ByteBuffervoid
Write the TextureData filled by#readPixels(GLAutoDrawable, boolean)
to file
-
Constructor Details
-
GLReadBufferUtil
public GLReadBufferUtil(boolean alpha, boolean write2Texture) - Parameters:
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 Texture
-
GLReadBufferUtil
public GLReadBufferUtil(GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider, boolean alpha, boolean write2Texture)
-
-
Method Details
-
getPixelBufferProvider
Returns theGLPixelBuffer.GLPixelBufferProvider
used by this instance. -
isValid
public boolean isValid() -
hasAlpha
public boolean hasAlpha() -
getGLPixelStorageModes
-
getPixelBuffer
Returns theGLPixelBuffer
, created and filled by#readPixels(GLAutoDrawable, boolean)
. -
rewindPixelBuffer
public void rewindPixelBuffer()rewind the raw pixel ByteBuffer -
getTextureData
- Returns:
- the resulting TextureData, filled by
#readPixels(GLAutoDrawable, boolean)
-
getTexture
- Returns:
- the Texture object filled by
#readPixels(GLAutoDrawable, boolean)
, if this instance writes to a 2d Texture, otherwise null. - See Also:
-
write
Write the TextureData filled by#readPixels(GLAutoDrawable, boolean)
to file -
readPixels
Read the drawable's pixels to TextureData and Texture, if requested at construction.- Parameters:
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 drawableGLDrawable.isGLOriented()
state is taken into account. Vertical flipping is propagated to TextureData and handled in a efficient manner there (TextureCoordinates and TextureIO writer).- See Also:
-
readPixels
public 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.- Parameters:
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 drawableGLDrawable.isGLOriented()
state is taken into account. Vertical flipping is propagated to TextureData and handled in a efficient manner there (TextureCoordinates and TextureIO writer).- See Also:
-
dispose
-