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, getHostPixelCompequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAllowRowStride, getAttributes, getHostPixelComppublic 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
IntBufferof sizewidth*height*SIZEOF_INT.
allocate in interface GLPixelBuffer.GLPixelBufferProviderallocate in interface GLPixelBuffer.SingletonGLPixelBufferProviderallocate in class AWTGLPixelBuffer.AWTGLPixelBufferProvidergl - 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.SingletonGLPixelBufferProviderpixelAttributes - 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.SingletonGLPixelBufferProvidercomponentCount - 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.SingletonGLPixelBufferProviderdispose in interface GLPixelBuffer.SingletonGLPixelBufferProviderCopyright 2010 JogAmp Community.