Package com.jogamp.opengl.util.awt
Class AWTGLPixelBuffer.AWTGLPixelBufferProvider
- java.lang.Object
-
- com.jogamp.opengl.util.awt.AWTGLPixelBuffer.AWTGLPixelBufferProvider
-
- All Implemented Interfaces:
GLPixelBuffer.GLPixelBufferProvider
- Direct Known Subclasses:
AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider
- Enclosing class:
- AWTGLPixelBuffer
public static class AWTGLPixelBuffer.AWTGLPixelBufferProvider extends Object implements GLPixelBuffer.GLPixelBufferProvider
Provider forAWTGLPixelBufferinstances.
-
-
Constructor Summary
Constructors Constructor Description AWTGLPixelBufferProvider(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.booleangetAllowRowStride()GLPixelBuffer.GLPixelAttributesgetAttributes(GL gl, int componentCount, boolean pack)GLPixelBuffer.GLPixelAttributesgetAttributes(GLProfile glp, int componentCount)intgetAWTFormat(GLProfile glp, int componentCount)Returns one of GL__, 4c -> 4c:BufferedImage.TYPE_INT_ARGB<->GL.GL_BGRAGLES, 4c -> 4c:BufferedImage.TYPE_INT_BGR<->GL.GL_RGBAGL__, 3c -> 4c:BufferedImage.TYPE_INT_RGB<->GL.GL_BGRAGLES, 3c -> 4c:BufferedImage.TYPE_INT_BGR<->GL.GL_RGBAPixelFormatgetAWTPixelFormat(GLProfile glp, int componentCount)PixelFormat.CompositiongetHostPixelComp(GLProfile glp, int componentCount)Returns the hostPixelFormat.CompositionmatchingGLandcomponentCountif required by implementation, otherwisenull.
-
-
-
Constructor Detail
-
AWTGLPixelBufferProvider
public AWTGLPixelBufferProvider(boolean allowRowStride)
- Parameters:
allowRowStride- Iftrue, allow row-stride, otherwise not. SeegetAllowRowStride()andGLPixelBuffer.requiresNewBuffer(GL, int, int, int). Iftrue, user shall decide whether to use awidth-aligned image.
-
-
Method Detail
-
getAllowRowStride
public boolean getAllowRowStride()
Description copied from interface:GLPixelBuffer.GLPixelBufferProvider- Specified by:
getAllowRowStridein interfaceGLPixelBuffer.GLPixelBufferProvider
-
getAttributes
public GLPixelBuffer.GLPixelAttributes getAttributes(GL gl, int componentCount, boolean pack)
Description copied from interface:GLPixelBuffer.GLPixelBufferProvider- Specified by:
getAttributesin interfaceGLPixelBuffer.GLPixelBufferProvider- Parameters:
gl- the corresponding currentGLcontext objectcomponentCount- 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.
-
getAttributes
public GLPixelBuffer.GLPixelAttributes getAttributes(GLProfile glp, int componentCount)
-
getHostPixelComp
public PixelFormat.Composition getHostPixelComp(GLProfile glp, int componentCount)
Returns the hostPixelFormat.CompositionmatchingGLandcomponentCountif required by implementation, otherwisenull.Returns a valid
PixelFormat.Compositioninstance fromgetAWTPixelFormat(GLProfile, int).- Specified by:
getHostPixelCompin interfaceGLPixelBuffer.GLPixelBufferProvider- Parameters:
glp- the corresponding currentGLcontext objectcomponentCount- RGBA component count, i.e. 1 (luminance, alpha or red), 3 (RGB) or 4 (RGBA)
-
getAWTFormat
public int getAWTFormat(GLProfile glp, int componentCount)
Returns one of- GL__, 4c -> 4c:
BufferedImage.TYPE_INT_ARGB<->GL.GL_BGRA - GLES, 4c -> 4c:
BufferedImage.TYPE_INT_BGR<->GL.GL_RGBA - GL__, 3c -> 4c:
BufferedImage.TYPE_INT_RGB<->GL.GL_BGRA - GLES, 3c -> 4c:
BufferedImage.TYPE_INT_BGR<->GL.GL_RGBA
- Parameters:
glp-componentCount-- Returns:
- GL__, 4c -> 4c:
-
getAWTPixelFormat
public PixelFormat getAWTPixelFormat(GLProfile glp, int componentCount)
-
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.- Specified by:
allocatein interfaceGLPixelBuffer.GLPixelBufferProvider- 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)
-
-