Package com.jogamp.opengl.util.awt
Class AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider
java.lang.Object
com.jogamp.opengl.util.awt.AWTGLPixelBuffer.AWTGLPixelBufferProvider
com.jogamp.opengl.util.awt.AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider
- All Implemented Interfaces:
GLPixelBuffer.GLPixelBufferProvider,GLPixelBuffer.SingletonGLPixelBufferProvider
- Enclosing class:
- AWTGLPixelBuffer
public static class AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider
extends AWTGLPixelBuffer.AWTGLPixelBufferProvider
implements GLPixelBuffer.SingletonGLPixelBufferProvider
Provider for singleton
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallocate(GL gl, PixelFormat.Composition hostPixComp, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean pack, int width, int height, int depth, int minByteSize) Allocates a newGLPixelBufferobject.voiddispose()Dispose all resources.getSingleBuffer(PixelFormat.Composition hostPixelComp, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean pack) Return the lastallocatedAWTGLPixelBuffer, if compatible w/ the givenPixelFormat.CompositionandGLPixelBuffer.GLPixelAttributes.initSingleton(GLProfile glp, int componentCount, boolean pack, int width, int height, int depth) Initializes the singleAWTGLPixelBufferw/ a given size, if not yetallocated.Methods inherited from class com.jogamp.opengl.util.awt.AWTGLPixelBuffer.AWTGLPixelBufferProvider
getAllowRowStride, getAttributes, getAttributes, getAWTFormat, getAWTPixelFormat, getHostPixelCompMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.jogamp.opengl.util.GLPixelBuffer.GLPixelBufferProvider
getAllowRowStride, getAttributes, getHostPixelComp
-
Constructor Details
-
SingleAWTGLPixelBufferProvider
public SingleAWTGLPixelBufferProvider(boolean allowRowStride) - Parameters:
allowRowStride- Iftrue, allow row-stride, otherwise not. SeeGLPixelBuffer.requiresNewBuffer(GL, int, int, int).
-
-
Method Details
-
allocate
public AWTGLPixelBuffer allocate(GL gl, PixelFormat.Composition hostPixComp, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean pack, int width, int height, int depth, int minByteSize) Allocates a newGLPixelBufferobject.The minimum required
remainingbyte size equals tominByteSize, if > 0, otherwise utilizeGLBuffers.sizeof(GL, int[], int, int, int, int, int, boolean)to calculate it.Returns an array backed
IntBufferof sizewidth*height*
SIZEOF_INT.Returns an array backed
IntBufferof sizewidth*height*
SIZEOF_INT.- Specified by:
allocatein interfaceGLPixelBuffer.GLPixelBufferProvider- Specified by:
allocatein interfaceGLPixelBuffer.SingletonGLPixelBufferProvider- Overrides:
allocatein classAWTGLPixelBuffer.AWTGLPixelBufferProvider- Parameters:
gl- the corresponding currentGLcontext objecthostPixComp- hostpixel format, i.e. of the source or sink depending onpack, e.g. fetched viaGLPixelBuffer.GLPixelBufferProvider.getHostPixelComp(GLProfile, int). Ifnull,pixelAttributesinstance maybe used or an exception is thrown, depending on implementation semantics.pixelAttributes- the desiredGLPixelBuffer.GLPixelAttributes, e.g. fetched viaGLPixelBuffer.GLPixelBufferProvider.getAttributes(GL, int, boolean)pack-truefor read mode GPU -> CPU, e.g.glReadPixels.falsefor 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.- See Also:
-
getSingleBuffer
public AWTGLPixelBuffer getSingleBuffer(PixelFormat.Composition hostPixelComp, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean pack) Return the lastallocatedAWTGLPixelBuffer, if compatible w/ the givenPixelFormat.CompositionandGLPixelBuffer.GLPixelAttributes.- Specified by:
getSingleBufferin interfaceGLPixelBuffer.SingletonGLPixelBufferProviderpixelAttributes- the desiredGLPixelBuffer.GLPixelAttributes, e.g. fetched viaGLPixelBuffer.GLPixelBufferProvider.getAttributes(GL, int, boolean)pack-truefor read mode GPU -> CPU, e.g.glReadPixels.falsefor write mode CPU -> GPU, e.g.glTexImage2D.
-
initSingleton
public AWTGLPixelBuffer initSingleton(GLProfile glp, int componentCount, boolean pack, int width, int height, int depth) Initializes the singleAWTGLPixelBufferw/ a given size, if not yetallocated.- Specified by:
initSingletonin interfaceGLPixelBuffer.SingletonGLPixelBufferProvidercomponentCount- RGBA component count, i.e. 1 (luminance, alpha or red), 3 (RGB) or 4 (RGBA)pack-truefor read mode GPU -> CPU, e.g.glReadPixels.falsefor write mode CPU -> GPU, e.g.glTexImage2D.- Returns:
- the newly initialized single
AWTGLPixelBuffer, or null if already allocated.
-
dispose
public void dispose()Description copied from interface:GLPixelBuffer.SingletonGLPixelBufferProviderDispose all resources.- Specified by:
disposein interfaceGLPixelBuffer.SingletonGLPixelBufferProvider
-