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 singletonAWTGLPixelBufferinstances.Provider instance holds the last
AWTGLPixelBufferinstanceallocated. A newallocationwill return same instance, if a new buffer is notrequired. The latter is true if size are compatible, henceallowRowStrideshould be enabled, if possible.
-
-
Constructor Summary
Constructors Constructor Description SingleAWTGLPixelBufferProvider(boolean allowRowStride)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AWTGLPixelBufferallocate(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.AWTGLPixelBuffergetSingleBuffer(PixelFormat.Composition hostPixelComp, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean pack)Return the lastallocatedAWTGLPixelBuffer, if compatible w/ the givenPixelFormat.CompositionandGLPixelBuffer.GLPixelAttributes.AWTGLPixelBufferinitSingleton(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, getHostPixelComp
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.jogamp.opengl.util.GLPixelBuffer.GLPixelBufferProvider
getAllowRowStride, getAttributes, getHostPixelComp
-
-
-
-
Constructor Detail
-
SingleAWTGLPixelBufferProvider
public SingleAWTGLPixelBufferProvider(boolean allowRowStride)
- Parameters:
allowRowStride- Iftrue, allow row-stride, otherwise not. SeeGLPixelBuffer.requiresNewBuffer(GL, int, int, int).
-
-
Method Detail
-
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:
GLPixelBuffer.GLPixelBufferProvider.getHostPixelComp(GLProfile, int),GLPixelBuffer.GLPixelBufferProvider.getAttributes(GL, int, boolean)
-
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
-
-