|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jogamp.opengl.util.GLPixelBuffer
public class GLPixelBuffer
OpenGL pixel data buffer, allowing user to provide buffers via their GLPixelBuffer.GLPixelBufferProvider implementation.
GLPixelBuffer.GLPixelBufferProvider produces a GLPixelBuffer.
You may use defaultProviderNoRowStride.
| Nested Class Summary | |
|---|---|
static class |
GLPixelBuffer.DefaultGLPixelBufferProvider
|
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. |
| Constructor Summary | |
|---|---|
GLPixelBuffer(GLPixelBuffer.GLPixelAttributes pixelAttributes,
int width,
int height,
int depth,
boolean pack,
Buffer buffer,
boolean allowRowStride)
|
|
| Method Summary | |
|---|---|
int |
capacity()
Returns the byte capacity of the buffer. |
Buffer |
clear()
See Buffer.clear(). |
void |
dispose()
Dispose resources. |
Buffer |
flip()
See Buffer.flip(). |
boolean |
getAllowRowStride()
Allow GL2ES3.GL_PACK_ROW_LENGTH, or GL2ES2.GL_UNPACK_ROW_LENGTH. |
boolean |
isValid()
Is not disposed and has byteSize > 0. |
int |
limit()
Returns the byte limit of the buffer. |
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 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. |
Buffer |
rewind()
See Buffer.rewind(). |
String |
toString()
|
StringBuilder |
toString(StringBuilder sb)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static GLPixelBuffer.GLPixelBufferProvider defaultProviderNoRowStride
GLPixelBuffer.GLPixelBufferProvider with GLPixelBuffer.GLPixelBufferProvider.getAllowRowStride() == false,
utilizing best match for GLPixelBuffer.GLPixelAttributes
and allocating a ByteBuffer.
public static GLPixelBuffer.GLPixelBufferProvider defaultProviderWithRowStride
GLPixelBuffer.GLPixelBufferProvider with GLPixelBuffer.GLPixelBufferProvider.getAllowRowStride() == true,
utilizing best match for GLPixelBuffer.GLPixelAttributes
and allocating a ByteBuffer.
public final GLPixelBuffer.GLPixelAttributes pixelAttributes
GLPixelBuffer.GLPixelAttributes.
public final int width
buffer's byteSize.
May not represent actual image width as user may re-use buffer for different dimensions, see requiresNewBuffer(GL, int, int, int).
public final int height
buffer's byteSize.
May not represent actual image height as user may re-use buffer for different dimensions, see requiresNewBuffer(GL, int, int, int).
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 final boolean allowRowStride
GL2ES3.GL_PACK_ROW_LENGTH, or GL2ES2.GL_UNPACK_ROW_LENGTH. See requiresNewBuffer(GL, int, int, int).
| Constructor Detail |
|---|
public GLPixelBuffer(GLPixelBuffer.GLPixelAttributes pixelAttributes,
int width,
int height,
int depth,
boolean pack,
Buffer buffer,
boolean allowRowStride)
pixelAttributes - the desired GLPixelBuffer.GLPixelAttributeswidth - in pixelsheight - in pixelsdepth - in pixelspack - true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPUbuffer - the backing arrayallowRowStride - If true, allow row-stride, otherwise not. See requiresNewBuffer(GL, int, int, int).| Method Detail |
|---|
public StringBuilder toString(StringBuilder sb)
public String toString()
toString in class Objectpublic final boolean getAllowRowStride()
GL2ES3.GL_PACK_ROW_LENGTH, or GL2ES2.GL_UNPACK_ROW_LENGTH.
public boolean isValid()
disposed and has byteSize > 0.
public Buffer rewind()
Buffer.rewind().
public int position()
buffer.
public Buffer position(int bytePos)
buffer.
public int capacity()
buffer.
public int limit()
buffer.
public Buffer flip()
Buffer.flip().
public Buffer clear()
Buffer.clear().
public boolean requiresNewBuffer(GL gl,
int newWidth,
int newHeight,
int newByteSize)
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 ,
method returns allowRowStride = falsetrue if the newByteSize > currentByteSize
or the newWidth != currentWidth.
If , see allowRowStride = trueGLPixelBuffer.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.
gl - the corresponding current GL context objectnewWidth - new width in pixelsnewHeight - new height in pixelsnewByteSize - 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().
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||