public static class GLPixelBuffer.DefaultGLPixelBufferProvider extends Object implements GLPixelBuffer.GLPixelBufferProvider
Constructor and Description |
---|
GLPixelBuffer.DefaultGLPixelBufferProvider(boolean allowRowStride) |
Modifier and Type | Method and Description |
---|---|
GLPixelBuffer |
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)
|
PixelFormat.Composition |
getHostPixelComp(GLProfile glp,
int componentCount)
Returns the host
PixelFormat.Composition matching GL and componentCount
if required by implementation, otherwise null . |
public GLPixelBuffer.DefaultGLPixelBufferProvider(boolean allowRowStride)
allowRowStride
- If true
, allow row-stride, otherwise not.
See getAllowRowStride()
and GLPixelBuffer.requiresNewBuffer(GL, int, int, int)
.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 PixelFormat.Composition getHostPixelComp(GLProfile glp, int componentCount)
PixelFormat.Composition
matching GL
and componentCount
if required by implementation, otherwise null
.
Returns null
!
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 GLPixelBuffer 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 NIO ByteBuffer
.
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.