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

OpenGL pixel data buffer, allowing user to provide buffers via their GLPixelBufferProvider implementation. More...

Inheritance diagram for com.jogamp.opengl.util.GLPixelBuffer:
Collaboration diagram for com.jogamp.opengl.util.GLPixelBuffer:

Classes

class  DefaultGLPixelBufferProvider
 
class  GLPixelAttributes
 Pixel attributes. More...
 
interface  GLPixelBufferProvider
 Allows user to interface with another toolkit to define GLPixelAttributes and memory buffer to produce TextureData. More...
 
interface  SingletonGLPixelBufferProvider
 Single GLPixelBuffer provider. More...
 

Public Member Functions

StringBuilder toString (StringBuilder sb)
 
String toString ()
 
 GLPixelBuffer (final GLPixelAttributes pixelAttributes, final boolean pack, final int width, final int height, final int depth, final Buffer buffer, final boolean allowRowStride)
 
final boolean getAllowRowStride ()
 Allow GL2ES3#GL_PACK_ROW_LENGTH, or GL2ES2#GL_UNPACK_ROW_LENGTH. More...
 
boolean isValid ()
 Is not disposed and has byteSize > 0. More...
 
Buffer rewind ()
 See Buffer#rewind(). More...
 
int position ()
 Returns the byte position of the buffer. More...
 
Buffer position (final int bytePos)
 Sets the byte position of the buffer. More...
 
int capacity ()
 Returns the byte capacity of the buffer. More...
 
int limit ()
 Returns the byte limit of the buffer. More...
 
Buffer flip ()
 See Buffer#flip(). More...
 
Buffer clear ()
 See Buffer#clear(). More...
 
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 alignment or byte size, otherwise false. More...
 
void dispose ()
 Dispose resources. More...
 

Public Attributes

final GLPixelAttributes pixelAttributes
 The GLPixelAttributes. More...
 
final int width
 Width in pixels, representing buffer's byteSize. More...
 
final int height
 Height in pixels, representing buffer's byteSize. More...
 
final int depth
 Depth in pixels. More...
 
final boolean pack
 Data packing direction. More...
 
final int byteSize
 Byte size of the buffer. More...
 
final Buffer buffer
 Buffer holding the pixel data. More...
 
final int bufferElemSize
 Buffer element size in bytes. More...
 
final boolean allowRowStride
 Allow GL2ES3#GL_PACK_ROW_LENGTH, or GL2ES2#GL_UNPACK_ROW_LENGTH. More...
 

Static Public Attributes

static final GLPixelBufferProvider defaultProviderNoRowStride = new DefaultGLPixelBufferProvider(false)
 Default GLPixelBufferProvider with GLPixelBufferProvider#getAllowRowStride() == false, utilizing best match for GLPixelAttributes and allocating a ByteBuffer. More...
 
static final GLPixelBufferProvider defaultProviderWithRowStride = new DefaultGLPixelBufferProvider(true)
 Default GLPixelBufferProvider with GLPixelBufferProvider#getAllowRowStride() == true, utilizing best match for GLPixelAttributes and allocating a ByteBuffer. More...
 

Detailed Description

OpenGL pixel data buffer, allowing user to provide buffers via their GLPixelBufferProvider implementation.

GLPixelBufferProvider produces a GLPixelBuffer.

You may use defaultProviderNoRowStride.

Definition at line 54 of file GLPixelBuffer.java.

Constructor & Destructor Documentation

◆ GLPixelBuffer()

com.jogamp.opengl.util.GLPixelBuffer.GLPixelBuffer ( final GLPixelAttributes  pixelAttributes,
final boolean  pack,
final int  width,
final int  height,
final int  depth,
final Buffer  buffer,
final boolean  allowRowStride 
)
Parameters
pixelAttributesthe desired GLPixelAttributes
packtrue for read mode GPU -> CPU, e.g. glReadPixels. false for write mode CPU -> GPU, e.g. glTexImage2D.
widthin pixels
heightin pixels
depthin pixels
bufferthe backing array
allowRowStrideIf true, allow row-stride, otherwise not. See requiresNewBuffer(GL, int, int, int).
hostPixelCompthe host PixelFormat.Composition

Definition at line 592 of file GLPixelBuffer.java.

Here is the caller graph for this function:

Member Function Documentation

◆ capacity()

int com.jogamp.opengl.util.GLPixelBuffer.capacity ( )

Returns the byte capacity of the buffer.

Definition at line 628 of file GLPixelBuffer.java.

◆ clear()

Buffer com.jogamp.opengl.util.GLPixelBuffer.clear ( )

See Buffer#clear().

Definition at line 643 of file GLPixelBuffer.java.

Here is the caller graph for this function:

◆ dispose()

void com.jogamp.opengl.util.GLPixelBuffer.dispose ( )

Dispose resources.

See isValid().

Reimplemented in com.jogamp.opengl.util.awt.AWTGLPixelBuffer.

Definition at line 689 of file GLPixelBuffer.java.

Here is the caller graph for this function:

◆ flip()

Buffer com.jogamp.opengl.util.GLPixelBuffer.flip ( )

See Buffer#flip().

Definition at line 638 of file GLPixelBuffer.java.

Here is the caller graph for this function:

◆ getAllowRowStride()

final boolean com.jogamp.opengl.util.GLPixelBuffer.getAllowRowStride ( )

◆ isValid()

boolean com.jogamp.opengl.util.GLPixelBuffer.isValid ( )

Is not disposed and has byteSize > 0.

Definition at line 608 of file GLPixelBuffer.java.

Here is the caller graph for this function:

◆ limit()

int com.jogamp.opengl.util.GLPixelBuffer.limit ( )

Returns the byte limit of the buffer.

Definition at line 633 of file GLPixelBuffer.java.

◆ position() [1/2]

int com.jogamp.opengl.util.GLPixelBuffer.position ( )

Returns the byte position of the buffer.

Definition at line 618 of file GLPixelBuffer.java.

Here is the caller graph for this function:

◆ position() [2/2]

Buffer com.jogamp.opengl.util.GLPixelBuffer.position ( final int  bytePos)

Sets the byte position of the buffer.

Definition at line 623 of file GLPixelBuffer.java.

◆ requiresNewBuffer()

boolean com.jogamp.opengl.util.GLPixelBuffer.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 alignment or byte size, otherwise false.

It is assumed that pixelAttributes, depth and pack stays the same!

The minimum required byte size equals to minByteSize, if > 0, otherwise GLBuffers.sizeof(..) is being used to calculate it. This value is referred to newByteSize.

If allowRowStride = false, method returns true if the newByteSize > currentByteSize or the newWidth != currentWidth.

If allowRowStride = true, see GLPixelBufferProvider#getAllowRowStride(), method returns true only if the newByteSize > currentByteSize. Assuming user utilizes the row-stride when dealing w/ the data, i.e. GL2ES3#GL_PACK_ROW_LENGTH.

Parameters
glthe corresponding current GL context object
newWidthnew width in pixels
newHeightnew height in pixels
newByteSizeif > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore.
See also
GLPixelBufferProvider::allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int)

Definition at line 674 of file GLPixelBuffer.java.

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

◆ rewind()

Buffer com.jogamp.opengl.util.GLPixelBuffer.rewind ( )

See Buffer#rewind().

Definition at line 613 of file GLPixelBuffer.java.

Here is the caller graph for this function:

◆ toString() [1/2]

String com.jogamp.opengl.util.GLPixelBuffer.toString ( )

Reimplemented in com.jogamp.opengl.util.awt.AWTGLPixelBuffer.

Definition at line 577 of file GLPixelBuffer.java.

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

◆ toString() [2/2]

StringBuilder com.jogamp.opengl.util.GLPixelBuffer.toString ( StringBuilder  sb)

Reimplemented in com.jogamp.opengl.util.awt.AWTGLPixelBuffer.

Definition at line 567 of file GLPixelBuffer.java.

Here is the call graph for this function:

Member Data Documentation

◆ allowRowStride

final boolean com.jogamp.opengl.util.GLPixelBuffer.allowRowStride

◆ buffer

final Buffer com.jogamp.opengl.util.GLPixelBuffer.buffer

Buffer holding the pixel data.

If rewind(), it holds byteSize Buffer#remaining() bytes.

By default the Buffer is a ByteBuffer, due to DefProvider#allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int). However, other GLPixelBufferProvider may utilize different Buffer types.

Definition at line 558 of file GLPixelBuffer.java.

◆ bufferElemSize

final int com.jogamp.opengl.util.GLPixelBuffer.bufferElemSize

Buffer element size in bytes.

Definition at line 560 of file GLPixelBuffer.java.

◆ byteSize

final int com.jogamp.opengl.util.GLPixelBuffer.byteSize

Byte size of the buffer.

Actually the number of Buffer#remaining() bytes when passed in ctor.

Definition at line 550 of file GLPixelBuffer.java.

◆ defaultProviderNoRowStride

final GLPixelBufferProvider com.jogamp.opengl.util.GLPixelBuffer.defaultProviderNoRowStride = new DefaultGLPixelBufferProvider(false)
static

Default GLPixelBufferProvider with GLPixelBufferProvider#getAllowRowStride() == false, utilizing best match for GLPixelAttributes and allocating a ByteBuffer.

Definition at line 217 of file GLPixelBuffer.java.

◆ defaultProviderWithRowStride

final GLPixelBufferProvider com.jogamp.opengl.util.GLPixelBuffer.defaultProviderWithRowStride = new DefaultGLPixelBufferProvider(true)
static

Default GLPixelBufferProvider with GLPixelBufferProvider#getAllowRowStride() == true, utilizing best match for GLPixelAttributes and allocating a ByteBuffer.

Definition at line 224 of file GLPixelBuffer.java.

◆ depth

final int com.jogamp.opengl.util.GLPixelBuffer.depth

Depth in pixels.

Definition at line 542 of file GLPixelBuffer.java.

◆ height

final int com.jogamp.opengl.util.GLPixelBuffer.height

Height in pixels, representing buffer's byteSize.

May not represent actual image height as user may re-use buffer for different dimensions, see requiresNewBuffer(GL, int, int, int).

Definition at line 540 of file GLPixelBuffer.java.

◆ pack

final boolean com.jogamp.opengl.util.GLPixelBuffer.pack

Data packing direction.

true for read mode GPU -> CPU, e.g. glReadPixels.

false for write mode CPU -> GPU, e.g. glTexImage2D.

Definition at line 548 of file GLPixelBuffer.java.

◆ pixelAttributes

final GLPixelAttributes com.jogamp.opengl.util.GLPixelBuffer.pixelAttributes

The GLPixelAttributes.

Definition at line 526 of file GLPixelBuffer.java.

◆ width

final int com.jogamp.opengl.util.GLPixelBuffer.width

Width in pixels, representing buffer's byteSize.

May not represent actual image width as user may re-use buffer for different dimensions, see requiresNewBuffer(GL, int, int, int).

Definition at line 533 of file GLPixelBuffer.java.


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