JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.opengl.util.awt.AWTGLReadBufferUtil Class Reference

GLReadBufferUtil specialization allowing to read out a frambuffer to an AWT BufferedImage utilizing AWTPixelBufferProviderInt for further AWT processing. More...

Inheritance diagram for com.jogamp.opengl.util.awt.AWTGLReadBufferUtil:
Collaboration diagram for com.jogamp.opengl.util.awt.AWTGLReadBufferUtil:

Public Member Functions

 AWTGLReadBufferUtil (final GLProfile glp, final boolean requestAlpha)
 
AWTGLPixelBuffer getAWTGLPixelBuffer ()
 Returns the AWTGLPixelBuffer, as filled by previous call to readPixels(GL, int, int, int, int, boolean). More...
 
BufferedImage readPixelsToBufferedImage (final GL gl, final boolean awtOrientation)
 Read the drawable's pixels to TextureData and Texture, if requested at construction, and returns an aligned BufferedImage. More...
 
BufferedImage readPixelsToBufferedImage (final GL gl, final int inX, final int inY, final int inWidth, final int inHeight, final boolean awtOrientation)
 Read the drawable's pixels to TextureData and Texture, if requested at construction, and returns an aligned BufferedImage. More...
 
- Public Member Functions inherited from com.jogamp.opengl.util.GLReadBufferUtil
 GLReadBufferUtil (final boolean requestAlpha, final boolean write2Texture)
 Using the default GLPixelBuffer: GLPixelBuffer#defaultProviderNoRowStride. More...
 
 GLReadBufferUtil (final GLPixelBufferProvider pixelBufferProvider, final boolean requestAlpha, final boolean write2Texture)
 
void setReadBuffer (final int name)
 
GLPixelBufferProvider getPixelBufferProvider ()
 Returns the GLPixelBufferProvider used by this instance. More...
 
boolean isValid ()
 
boolean hasAlpha ()
 Returns true if the OpenGL read data contains alpha. More...
 
GLPixelStorageModes getGLPixelStorageModes ()
 
GLPixelBuffer getPixelBuffer ()
 Returns the GLPixelBuffer, created and filled by readPixels(GLAutoDrawable, boolean). More...
 
void rewindPixelBuffer ()
 rewind the raw pixel ByteBuffer More...
 
TextureData getTextureData ()
 
Texture getTexture ()
 
void write (final File dest)
 Write the TextureData filled by readPixels(GLAutoDrawable, boolean) to file. More...
 
boolean readPixels (final GL gl, final boolean mustFlipVertically)
 Read the drawable's pixels to TextureData and Texture, if requested at construction. More...
 
boolean readPixels (final GL gl, final int inX, final int inY, final int inWidth, final int inHeight, final boolean mustFlipVertically)
 Read the drawable's pixels to TextureData and Texture, if requested at construction. More...
 
void dispose (final GL gl)
 

Additional Inherited Members

- Protected Member Functions inherited from com.jogamp.opengl.util.GLReadBufferUtil
boolean readPixelsImpl (final GLDrawable drawable, final GL gl, final int inX, final int inY, final int width, final int height, final boolean mustFlipVertically)
 
- Protected Attributes inherited from com.jogamp.opengl.util.GLReadBufferUtil
final GLPixelBufferProvider pixelBufferProvider
 
final Texture readTexture
 
final GLPixelStorageModes psm
 
final boolean alphaRequested
 
boolean hasAlpha
 
GLPixelBuffer readPixelBuffer = null
 
TextureData readTextureData = null
 
int readBuffer = -1
 

Detailed Description

GLReadBufferUtil specialization allowing to read out a frambuffer to an AWT BufferedImage utilizing AWTPixelBufferProviderInt for further AWT processing.

Definition at line 44 of file AWTGLReadBufferUtil.java.

Constructor & Destructor Documentation

◆ AWTGLReadBufferUtil()

com.jogamp.opengl.util.awt.AWTGLReadBufferUtil.AWTGLReadBufferUtil ( final GLProfile  glp,
final boolean  requestAlpha 
)

Using the AWT GLPixelBuffer: AWTGLPixelBuffer.AWTGLPixelBufferProvider, always using alpha on OpenGL operations.

The host PixelFormat will be a 32bit INT compatible to AWT, capable to store the GL RGBA read data, regardless whether AWT utilizes the alpha component.

Parameters
requestAlphatrue for RGBA readPixels, otherwise RGB readPixels. Disclaimer: hasAlpha()==true is forced due to the used AWTGLPixelBuffer.AWTGLPixelBufferProvider when calling readPixels.

Definition at line 55 of file AWTGLReadBufferUtil.java.

Here is the call graph for this function:

Member Function Documentation

◆ getAWTGLPixelBuffer()

AWTGLPixelBuffer com.jogamp.opengl.util.awt.AWTGLReadBufferUtil.getAWTGLPixelBuffer ( )

Returns the AWTGLPixelBuffer, as filled by previous call to readPixels(GL, int, int, int, int, boolean).

Definition at line 62 of file AWTGLReadBufferUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readPixelsToBufferedImage() [1/2]

BufferedImage com.jogamp.opengl.util.awt.AWTGLReadBufferUtil.readPixelsToBufferedImage ( final GL  gl,
final boolean  awtOrientation 
)

Read the drawable's pixels to TextureData and Texture, if requested at construction, and returns an aligned BufferedImage.

Parameters
glthe current GL context object. It's read drawable is being used as the pixel source.
awtOrientationflips the data vertically if true. 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).
See also
AWTGLReadBufferUtil(GLProfile, boolean)

Definition at line 76 of file AWTGLReadBufferUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readPixelsToBufferedImage() [2/2]

BufferedImage com.jogamp.opengl.util.awt.AWTGLReadBufferUtil.readPixelsToBufferedImage ( final GL  gl,
final int  inX,
final int  inY,
final int  inWidth,
final int  inHeight,
final boolean  awtOrientation 
)

Read the drawable's pixels to TextureData and Texture, if requested at construction, and returns an aligned BufferedImage.

Parameters
glthe current GL context object. It's read drawable is being used as the pixel source.
inXreadPixel x offset
inYreadPixel y offset
inWidthoptional readPixel width value, used if [1 .. drawable.width], otherwise using drawable.width
inHeightoptional readPixel height, used if [1 .. drawable.height], otherwise using drawable.height
awtOrientationflips the data vertically if true. 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).
See also
AWTGLReadBufferUtil(GLProfile, boolean)

Definition at line 96 of file AWTGLReadBufferUtil.java.

Here is the call graph for this function:

The documentation for this class was generated from the following file: