public static class AWTGLPixelBuffer.AWTGLPixelBufferProvider extends Object implements GLPixelBuffer.GLPixelBufferProvider
AWTGLPixelBuffer
instances.Constructor and Description |
---|
AWTGLPixelBuffer.AWTGLPixelBufferProvider(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. |
boolean |
getAllowRowStride()
|
GLPixelBuffer.GLPixelAttributes |
getAttributes(GL gl,
int componentCount,
boolean pack)
|
GLPixelBuffer.GLPixelAttributes |
getAttributes(GLProfile glp,
int componentCount) |
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
|
PixelFormat |
getAWTPixelFormat(GLProfile glp,
int componentCount) |
PixelFormat.Composition |
getHostPixelComp(GLProfile glp,
int componentCount)
Returns the host
PixelFormat.Composition matching GL and componentCount
if required by implementation, otherwise null . |
public AWTGLPixelBuffer.AWTGLPixelBufferProvider(boolean allowRowStride)
allowRowStride
- If true
, allow row-stride, otherwise not.
See getAllowRowStride()
and GLPixelBuffer.requiresNewBuffer(GL, int, int, int)
.
If true
, user shall decide whether to use a width-aligned image
.public boolean getAllowRowStride()
GLPixelBuffer.GLPixelBufferProvider
getAllowRowStride
in interface GLPixelBuffer.GLPixelBufferProvider
public GLPixelBuffer.GLPixelAttributes getAttributes(GL gl, int componentCount, boolean pack)
GLPixelBuffer.GLPixelBufferProvider
getAttributes
in interface GLPixelBuffer.GLPixelBufferProvider
gl
- the corresponding current GL
context objectcomponentCount
- 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
.public GLPixelBuffer.GLPixelAttributes getAttributes(GLProfile glp, int componentCount)
public PixelFormat.Composition getHostPixelComp(GLProfile glp, int componentCount)
PixelFormat.Composition
matching GL
and componentCount
if required by implementation, otherwise null
.
Returns a valid PixelFormat.Composition
instance from getAWTPixelFormat(GLProfile, int)
.
getHostPixelComp
in interface GLPixelBuffer.GLPixelBufferProvider
glp
- the corresponding current GL
context objectcomponentCount
- RGBA component count, i.e. 1 (luminance, alpha or red), 3 (RGB) or 4 (RGBA)public int getAWTFormat(GLProfile glp, int componentCount)
BufferedImage.TYPE_INT_ARGB
<-> GL.GL_BGRA
BufferedImage.TYPE_INT_BGR
<-> GL.GL_RGBA
BufferedImage.TYPE_INT_RGB
<-> GL.GL_BGRA
BufferedImage.TYPE_INT_BGR
<-> GL.GL_RGBA
glp
- componentCount
- public PixelFormat getAWTPixelFormat(GLProfile glp, int componentCount)
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
.
allocate
in interface GLPixelBuffer.GLPixelBufferProvider
gl
- 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)
Copyright 2010 JogAmp Community.