public class GLPixelBuffer extends Object
GLPixelBuffer.GLPixelBufferProvider
implementation.
GLPixelBuffer.GLPixelBufferProvider
produces a GLPixelBuffer
.
You may use defaultProvider
.
Modifier and Type | Class and Description |
---|---|
static class |
GLPixelBuffer.GLPixelAttributes
Pixel attributes.
|
static interface |
GLPixelBuffer.GLPixelBufferProvider
Allows user to interface with another toolkit to define
GLPixelBuffer.GLPixelAttributes and memory buffer to produce TextureData . |
static interface |
GLPixelBuffer.SingletonGLPixelBufferProvider
Single
GLPixelBuffer provider. |
Modifier and Type | Field and Description |
---|---|
Buffer |
buffer
Buffer holding the pixel data.
|
int |
bufferElemSize
Buffer element size in bytes.
|
int |
byteSize
Byte size of the buffer.
|
static GLPixelBuffer.GLPixelBufferProvider |
defaultProvider
Default
GLPixelBuffer.GLPixelBufferProvider utilizing best match for GLPixelBuffer.GLPixelAttributes
and allocating a ByteBuffer . |
int |
depth
Depth in pixels.
|
int |
height
Height in pixels.
|
boolean |
pack
Data packing direction.
|
GLPixelBuffer.GLPixelAttributes |
pixelAttributes
|
int |
width
Width in pixels.
|
Constructor and Description |
---|
GLPixelBuffer(GLPixelBuffer.GLPixelAttributes pixelAttributes,
int width,
int height,
int depth,
boolean pack,
Buffer buffer) |
Modifier and Type | Method and Description |
---|---|
Buffer |
clear() |
void |
dispose()
Dispose resources.
|
Buffer |
flip() |
boolean |
isValid()
|
int |
position()
Returns the byte position of the
buffer . |
Buffer |
position(int bytePos)
Sets the byte position of the
buffer . |
boolean |
requiresNewBuffer(GL gl,
int newWidth,
int newHeight,
int minByteSize)
Returns true, if
invalid or implementation requires a new buffer based on the new size
due to pixel alignment or byte size, otherwise false. |
Buffer |
rewind() |
String |
toString() |
StringBuffer |
toString(StringBuffer sb) |
public static GLPixelBuffer.GLPixelBufferProvider defaultProvider
GLPixelBuffer.GLPixelBufferProvider
utilizing best match for GLPixelBuffer.GLPixelAttributes
and allocating
a ByteBuffer
.public final GLPixelBuffer.GLPixelAttributes pixelAttributes
public final int width
public final int height
public final int depth
public final boolean pack
true
for read mode GPU -> CPU, false
for write mode CPU -> GPU.public final int byteSize
Buffer.remaining()
bytes when passed in ctor.public final Buffer buffer
rewind()
, it holds byteSize
Buffer.remaining()
bytes.
By default the Buffer
is a ByteBuffer
, due to DefProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int)
.
However, other GLPixelBuffer.GLPixelBufferProvider
may utilize different Buffer
types.
public final int bufferElemSize
public GLPixelBuffer(GLPixelBuffer.GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, Buffer buffer)
public StringBuffer toString(StringBuffer sb)
public boolean isValid()
public Buffer rewind()
public int position()
buffer
.public Buffer flip()
public Buffer clear()
public boolean requiresNewBuffer(GL gl, int newWidth, int newHeight, int minByteSize)
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 utilize GLBuffers.sizeof(..)
to calculate it.
gl
- the corresponding current GL context objectnewWidth
- new width in pixelsnewHeight
- new height in pixelsminByteSize
- if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore.GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int)
public void dispose()
isValid()
.Copyright 2010 JogAmp Community.