Object handle for OpenGL Pixel Buffer Objects. More...
#include <HdlPBO.hpp>
Public Member Functions | |
HdlPBO (int _w, int _h, int _c, int _cs, GLenum aim, GLenum freq, int size=-1) | |
HdlPBO constructor. More... | |
HdlPBO (const HdlAbstractTextureFormat &fmt, GLenum aim, GLenum freq) | |
HdlPBO constructor. More... | |
int | getWidth (void) |
int | getHeight (void) |
int | getChannelCount (void) |
int | getChannelSize (void) |
void | copyToTexture (HdlTexture &texture, int oX=0, int oY=0, int w=-1, int h=-1, GLenum mode=GL_NONE, GLenum depth=GL_NONE) |
void | bindAsPack (void) |
Bind PBO to GL_PIXEL_PACK_BUFFER, to gather data from a buffer or a texture. | |
void | bindAsUnpack (void) |
Bind PBO to GL_PIXEL_UNPACK_BUFFER, to send data to a buffer or a texture. | |
Public Member Functions inherited from Glip::CoreGL::HdlGeBO | |
HdlGeBO (GLsizeiptr _size, GLenum infoTarget, GLenum infoUsage) | |
HdlGeBO Construtor. More... | |
HdlGeBO (GLuint id, GLsizeiptr _size, GLenum infoTarget, GLenum infoUsage) | |
HdlGeBO Construtor. More... | |
GLsizeiptr | getSize (void) |
Get the size of the Buffer Object. More... | |
GLuint | getID (void) |
Get the ID of the Buffer Object. More... | |
GLenum | getTarget (void) |
Get the target of the Buffer Object. More... | |
GLenum | getUsage (void) |
Get the usage of the Buffer Object. More... | |
void | bind (GLenum target=GL_NONE) |
Bind the Buffer Object to target. More... | |
void * | map (GLenum access=GL_NONE, GLenum target=GL_NONE) |
Map the Buffer Object into the CPU memory. More... | |
void | write (const void *data) |
Write data to a Buffer Object with classical glBufferData method. More... | |
void | subWrite (const void *data, GLsizeiptr size, GLintptr offset) |
Write data to a Buffer Object with classical glBufferSubData method. More... | |
Static Public Member Functions | |
static void | unbind (GLenum target=0) |
Unbind the PBO bound to target. More... | |
static void | unmap (GLenum target=0) |
Unmap the PBO mapped from/to target. More... | |
Static Public Member Functions inherited from Glip::CoreGL::HdlGeBO | |
static void | unbind (GLenum target) |
Unbind any Buffer Object. More... | |
static void | unmap (GLenum target) |
Unmap any Buffer Object. More... | |
static bool | isBound (GLenum target) |
Test if the target is bound. More... | |
static bool | isMapped (GLenum target) |
Test if the target is mapped. More... | |
Object handle for OpenGL Pixel Buffer Objects.
How to use a PBO to upload data to a texture :
For reading operations, use Glip::Modules::PBOTextureReader.
HdlPBO::HdlPBO | ( | int | _w, |
int | _h, | ||
int | _c, | ||
int | _cs, | ||
GLenum | aim, | ||
GLenum | freq, | ||
int | size = -1 |
||
) |
HdlPBO constructor.
_w | The width of the buffer. |
_h | The height of the buffer. |
_c | The number of channels. |
_cs | The size of each channel (in bytes). |
aim | The target (GL_PIXEL_UNPACK_BUFFER_ARB, GL_PIXEL_PACK_BUFFER_ARB). |
freq | The frequency (GL_STATIC_DRAW_ARB, GL_STATIC_READ_ARB, GL_STATIC_COPY_ARB, GL_DYNAMIC_DRAW_ARB, GL_DYNAMIC_READ_ARB, GL_DYNAMIC_COPY_ARB, GL_STREAM_DRAW_ARB, GL_STREAM_READ_ARB, GL_STREAM_COPY_ARB). |
size | The size of the buffer, computed by default with previous parameters. |
HdlPBO::HdlPBO | ( | const HdlAbstractTextureFormat & | fmt, |
GLenum | aim, | ||
GLenum | freq | ||
) |
HdlPBO constructor.
fmt | The format to copy, this must an uncompressed format. |
aim | The target (GL_PIXEL_UNPACK_BUFFER_ARB, GL_PIXEL_PACK_BUFFER_ARB). |
freq | The frequency (GL_STATIC_DRAW_ARB, GL_STATIC_READ_ARB, GL_STATIC_COPY_ARB, GL_DYNAMIC_DRAW_ARB, GL_DYNAMIC_READ_ARB, GL_DYNAMIC_COPY_ARB, GL_STREAM_DRAW_ARB, GL_STREAM_READ_ARB, GL_STREAM_COPY_ARB). |
void HdlPBO::copyToTexture | ( | HdlTexture & | texture, |
int | oX = 0 , |
||
int | oY = 0 , |
||
int | w = -1 , |
||
int | h = -1 , |
||
GLenum | mode = GL_NONE , |
||
GLenum | depth = GL_NONE |
||
) |
texture | The target texture. |
oX | The offset in X direction for the destination target, default is 0. |
oY | The offset in Y direction for the destination target, default is 0. |
w | The width to be copied, default is the width of texture. |
h | The height to be copied, default is the height of texture. |
mode | The channel layout of the input data, default is the mode of texture. |
depth | The depth of the input data, default is the depth of texture. |
int HdlPBO::getChannelCount | ( | void | ) |
int HdlPBO::getChannelSize | ( | void | ) |
int HdlPBO::getHeight | ( | void | ) |
int HdlPBO::getWidth | ( | void | ) |
|
static |
Unbind the PBO bound to target.
target | The target binding point. |
|
static |
Unmap the PBO mapped from/to target.
target | The target binding point. |