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 newGLPixelBuffer
object.void
dispose()
Dispose all resources.getSingleBuffer
(PixelFormat.Composition hostPixelComp, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean pack) Return the lastallocated
AWTGLPixelBuffer
, if compatible w/ the givenPixelFormat.Composition
andGLPixelBuffer.GLPixelAttributes
.initSingleton
(GLProfile glp, int componentCount, boolean pack, int width, int height, int depth) Initializes the singleAWTGLPixelBuffer
w/ 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 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 newGLPixelBuffer
object.The minimum required
remaining
byte size equals tominByteSize
, if > 0, otherwise utilizeGLBuffers.sizeof(GL, int[], int, int, int, int, int, boolean)
to calculate it.Returns an array backed
IntBuffer
of sizewidth*height*
SIZEOF_INT
.Returns an array backed
IntBuffer
of sizewidth*height*
SIZEOF_INT
.- Specified by:
allocate
in interfaceGLPixelBuffer.GLPixelBufferProvider
- Specified by:
allocate
in interfaceGLPixelBuffer.SingletonGLPixelBufferProvider
- Overrides:
allocate
in classAWTGLPixelBuffer.AWTGLPixelBufferProvider
- Parameters:
gl
- the corresponding currentGL
context objecthostPixComp
- hostpixel format
, i.e. of the source or sink depending onpack
, e.g. fetched viaGLPixelBuffer.GLPixelBufferProvider.getHostPixelComp(GLProfile, int)
. Ifnull
,pixelAttributes
instance 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
-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.- See Also:
-
getSingleBuffer
public AWTGLPixelBuffer getSingleBuffer(PixelFormat.Composition hostPixelComp, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean pack) Return the lastallocated
AWTGLPixelBuffer
, if compatible w/ the givenPixelFormat.Composition
andGLPixelBuffer.GLPixelAttributes
.- Specified by:
getSingleBuffer
in interfaceGLPixelBuffer.SingletonGLPixelBufferProvider
pixelAttributes
- the desiredGLPixelBuffer.GLPixelAttributes
, e.g. fetched viaGLPixelBuffer.GLPixelBufferProvider.getAttributes(GL, int, boolean)
pack
-true
for read mode GPU -> CPU, e.g.glReadPixels
.false
for 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 singleAWTGLPixelBuffer
w/ a given size, if not yetallocated
.- Specified by:
initSingleton
in interfaceGLPixelBuffer.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
.- Returns:
- the newly initialized single
AWTGLPixelBuffer
, or null if already allocated.
-
dispose
public void dispose()Description copied from interface:GLPixelBuffer.SingletonGLPixelBufferProvider
Dispose all resources.- Specified by:
dispose
in interfaceGLPixelBuffer.SingletonGLPixelBufferProvider
-