public static class AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider extends AWTGLPixelBuffer.AWTGLPixelBufferProvider implements GLPixelBuffer.SingletonGLPixelBufferProvider
AWTGLPixelBuffer
instances.
Provider instance holds the last AWTGLPixelBuffer
instance
allocated
.
A new allocation
will return same instance, if a new buffer is not required
.
The latter is true if size are compatible, hence allowRowStride
should be enabled, if possible.
Constructor and Description |
---|
AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider(boolean allowRowStride) |
Modifier and Type | Method and Description |
---|---|
AWTGLPixelBuffer |
allocate(GL gl,
PixelFormat.Composition hostPixComp,
GLPixelBuffer.GLPixelAttributes pixelAttributes,
boolean pack,
int width,
int height,
int depth,
int minByteSize)
Allocates a new
GLPixelBuffer object. |
void |
dispose()
Dispose all resources.
|
AWTGLPixelBuffer |
getSingleBuffer(PixelFormat.Composition hostPixelComp,
GLPixelBuffer.GLPixelAttributes pixelAttributes,
boolean pack)
Return the last
allocated
AWTGLPixelBuffer , if compatible w/ the given PixelFormat.Composition and GLPixelAttributes . |
AWTGLPixelBuffer |
initSingleton(GLProfile glp,
int componentCount,
boolean pack,
int width,
int height,
int depth)
Initializes the single
AWTGLPixelBuffer w/ a given size, if not yet allocated . |
getAllowRowStride, getAttributes, getAttributes, getAWTFormat, getAWTPixelFormat, getHostPixelComp
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAllowRowStride, getAttributes, getHostPixelComp
public AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider(boolean allowRowStride)
allowRowStride
- If true
, allow row-stride, otherwise not. See GLPixelBuffer.requiresNewBuffer(GL, int, int, int)
.public AWTGLPixelBuffer allocate(GL gl, PixelFormat.Composition hostPixComp, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean pack, int width, int height, int depth, int minByteSize)
GLPixelBuffer
object.
The minimum required remaining
byte size equals to minByteSize
, if > 0,
otherwise utilize GLBuffers.sizeof(GL, int[], int, int, int, int, int, boolean)
to calculate it.
Returns an array backed IntBuffer
of size
width*height*SIZEOF_INT
.Returns an array backed
IntBuffer
of sizewidth*height*SIZEOF_INT
.
allocate
in interface GLPixelBuffer.GLPixelBufferProvider
allocate
in interface GLPixelBuffer.SingletonGLPixelBufferProvider
allocate
in class AWTGLPixelBuffer.AWTGLPixelBufferProvider
gl
- the corresponding current GL
context objecthostPixComp
- host pixel format
, i.e. of the source or sink depending on pack
,
e.g. fetched via GLPixelBuffer.GLPixelBufferProvider.getHostPixelComp(GLProfile, int)
.
If null
, pixelAttributes
instance maybe used or an exception is thrown,
depending on implementation semantics.pixelAttributes
- the desired GLPixelBuffer.GLPixelAttributes
, e.g. fetched via GLPixelBuffer.GLPixelBufferProvider.getAttributes(GL, int, boolean)
pack
- true
for read mode GPU -> CPU, e.g. glReadPixels
.
false
for write mode CPU -> GPU, e.g. glTexImage2D
.width
- in pixelsheight
- in pixelsdepth
- in pixelsminByteSize
- if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore.GLPixelBuffer.GLPixelBufferProvider.getHostPixelComp(GLProfile, int)
,
GLPixelBuffer.GLPixelBufferProvider.getAttributes(GL, int, boolean)
public AWTGLPixelBuffer getSingleBuffer(PixelFormat.Composition hostPixelComp, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean pack)
allocated
AWTGLPixelBuffer
, if compatible w/ the given PixelFormat.Composition
and GLPixelAttributes
.getSingleBuffer
in interface GLPixelBuffer.SingletonGLPixelBufferProvider
pixelAttributes
- the desired GLPixelBuffer.GLPixelAttributes
, e.g. fetched via GLPixelBuffer.GLPixelBufferProvider.getAttributes(GL, int, boolean)
pack
- true
for read mode GPU -> CPU, e.g. glReadPixels
.
false
for write mode CPU -> GPU, e.g. glTexImage2D
.public AWTGLPixelBuffer initSingleton(GLProfile glp, int componentCount, boolean pack, int width, int height, int depth)
AWTGLPixelBuffer
w/ a given size, if not yet allocated
.initSingleton
in interface GLPixelBuffer.SingletonGLPixelBufferProvider
componentCount
- RGBA component count, i.e. 1 (luminance, alpha or red), 3 (RGB) or 4 (RGBA)pack
- true
for read mode GPU -> CPU, e.g. glReadPixels
.
false
for write mode CPU -> GPU, e.g. glTexImage2D
.AWTGLPixelBuffer
, or null if already allocated.public void dispose()
GLPixelBuffer.SingletonGLPixelBufferProvider
dispose
in interface GLPixelBuffer.SingletonGLPixelBufferProvider
Copyright 2010 JogAmp Community.