Class PixelUnpackBufferImpl
java.lang.Object
cz.fidentis.analyst.glsl.buffers.impl.AbstractBuffer
cz.fidentis.analyst.glsl.buffers.impl.PixelUnpackBufferImpl
- All Implemented Interfaces:
GlslBuffer
,PixelUnpackBuffer
A buffer for
GL_PIXEL_UNPACK_BUFFER
target.-
Constructor Summary
ConstructorsConstructorDescriptionPixelUnpackBufferImpl
(BufferDef bufferName, com.jogamp.opengl.GLContext glContext, int usage, long itemSize) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
allocate
(long items, boolean reset) Allocates memory for this buffer on GPU.void
bind()
Binds this buffer to the OpenGL context (binding points of GPU rendering pipeline), so it become visible for shaders.long
This buffer stores some amount of items of the same type (integers, floats, etc.).int
getUsage()
Returns buffer usage typeMethods inherited from class cz.fidentis.analyst.glsl.buffers.impl.AbstractBuffer
getBindingIndex, getBufferName, getGlName, getGlTarget, glContext, setGlName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface cz.fidentis.analyst.glsl.buffers.GlslBuffer
getBindingIndex, getBufferName, getGlName, getGlTarget, glContext
-
Constructor Details
-
PixelUnpackBufferImpl
public PixelUnpackBufferImpl(BufferDef bufferName, com.jogamp.opengl.GLContext glContext, int usage, long itemSize) Constructor.- Parameters:
bufferName
- buffer nameglContext
- OpenGL contextusage
- OpenGL usage typeitemSize
- The size of buffer's items
-
-
Method Details
-
bind
public void bind()Description copied from interface:GlslBuffer
Binds this buffer to the OpenGL context (binding points of GPU rendering pipeline), so it become visible for shaders. Buffers can be bound to their binding points even unallocated. Do not use this method directly. As every buffer should be included in aGlslBufferGroup
, useGlslBufferGroup.bindBuffer(cz.fidentis.analyst.glsl.buffers.BufferDef)
to bind buffers individually orGlslBufferGroup.bindSsboBuffers()
to allocate all SSBO buffers at once.- Specified by:
bind
in interfaceGlslBuffer
-
getUsage
public int getUsage()Description copied from interface:PixelUnpackBuffer
Returns buffer usage type- Specified by:
getUsage
in interfacePixelUnpackBuffer
- Returns:
- usage type
-
getItemSize
public long getItemSize()Description copied from interface:PixelUnpackBuffer
This buffer stores some amount of items of the same type (integers, floats, etc.). Therefore, this method returns the size (number of bytes) of a single item.- Specified by:
getItemSize
in interfacePixelUnpackBuffer
- Returns:
- items' size
-
allocate
public void allocate(long items, boolean reset) Description copied from interface:PixelUnpackBuffer
Allocates memory for this buffer on GPU. Can be used multiple times to resize the buffer. Resulting buffer will occupyitems *
PixelUnpackBuffer.getItemSize()
bytes.- Specified by:
allocate
in interfacePixelUnpackBuffer
- Parameters:
items
- how many items are going to be in the buffer (resulting buffer will haveitems * ssboDef.getItemSize()
bytes)reset
- iftrue
, then fills the buffer by zeros
-