GLIP-Lib
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
Glip::CoreGL::HdlGeBO Class Reference

Object handle for OpenGL Buffer Object (VBO, PBO, VAO, ...). More...

#include <HdlGeBO.hpp>

Inheritance diagram for Glip::CoreGL::HdlGeBO:
Inheritance graph

Public Member Functions

 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)
 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...
 

Detailed Description

Object handle for OpenGL Buffer Object (VBO, PBO, VAO, ...).

Constructor & Destructor Documentation

HdlGeBO::HdlGeBO ( GLsizeiptr  _size,
GLenum  infoTarget,
GLenum  infoUsage 
)

HdlGeBO Construtor.

Parameters
_sizeSize of the buffer, in bytes.
infoTargetTarget kind, among GL_ARRAY_BUFFER_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB, GL_PIXEL_UNPACK_BUFFER_ARB, GL_PIXEL_PACK_BUFFER_ARB.
infoUsageUsage kind among 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.
HdlGeBO::HdlGeBO ( GLuint  id,
GLsizeiptr  _size,
GLenum  infoTarget,
GLenum  infoUsage 
)

HdlGeBO Construtor.

Parameters
idGL id of the Buffer Object to be mapped in.
_sizeSize of the buffer, in bytes.
infoTargetTarget kind, among GL_ARRAY_BUFFER_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB, GL_PIXEL_UNPACK_BUFFER_ARB, GL_PIXEL_PACK_BUFFER_ARB.
infoUsageUsage kind among 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.

Member Function Documentation

void HdlGeBO::bind ( GLenum  target = GL_NONE)

Bind the Buffer Object to target.

Parameters
targetThe target (GL_ARRAY_BUFFER_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB, GL_PIXEL_UNPACK_BUFFER_ARB, GL_PIXEL_PACK_BUFFER_ARB), default is the target specified for this object.
GLuint HdlGeBO::getID ( void  )

Get the ID of the Buffer Object.

Returns
ID of the Buffer Object
GLsizeiptr HdlGeBO::getSize ( void  )

Get the size of the Buffer Object.

Returns
Size of the BO in bytes.
GLenum HdlGeBO::getTarget ( void  )

Get the target of the Buffer Object.

Returns
Target of the Buffer Object, among : GL_ARRAY_BUFFER_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB, GL_PIXEL_UNPACK_BUFFER_ARB, GL_PIXEL_PACK_BUFFER_ARB.
GLenum HdlGeBO::getUsage ( void  )

Get the usage of the Buffer Object.

Returns
ID of the usage, among : 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.
bool HdlGeBO::isBound ( GLenum  target)
static

Test if the target is bound.

Parameters
targetThe target (GL_ARRAY_BUFFER_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB, GL_PIXEL_UNPACK_BUFFER_ARB, GL_PIXEL_PACK_BUFFER_ARB).
Returns
true if the target is bound.
bool HdlGeBO::isMapped ( GLenum  target)
static

Test if the target is mapped.

Parameters
targetThe target (GL_ARRAY_BUFFER_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB, GL_PIXEL_UNPACK_BUFFER_ARB, GL_PIXEL_PACK_BUFFER_ARB).
Returns
true if the target is mapped.
void * HdlGeBO::map ( GLenum  target = GL_NONE,
GLenum  access = GL_NONE 
)

Map the Buffer Object into the CPU memory.

Parameters
accessKind of access, among GL_READ_ONLY_ARB, GL_WRITE_ONLY_ARB, GL_READ_WRITE_ARB, default can be used is target is GL_PIXEL_UNPACK_BUFFER_ARB or GL_PIXEL_PACK_BUFFER_ARB (will use respectively GL_WRITE_ONLY_ARB or GL_READ_ONLY_ARB). Will raise an exception otherwise.
targetTarget mapping point, among GL_ARRAY_BUFFER_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB, GL_PIXEL_UNPACK_BUFFER_ARB, GL_PIXEL_PACK_BUFFER_ARB, default is the target specified for this object.
Returns
Pointer in CPU memory.
void HdlGeBO::subWrite ( const void *  data,
GLsizeiptr  size,
GLintptr  offset 
)

Write data to a Buffer Object with classical glBufferSubData method.

Parameters
dataThe data to write.
sizeSize, in bytes, of the subset.
offsetOffset to apply, in bytes, before writting.
void HdlGeBO::unbind ( GLenum  target)
static

Unbind any Buffer Object.

Parameters
targetTarget binding point, among GL_ARRAY_BUFFER_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB, GL_PIXEL_UNPACK_BUFFER_ARB, GL_PIXEL_PACK_BUFFER_ARB.
void HdlGeBO::unmap ( GLenum  target)
static

Unmap any Buffer Object.

Parameters
targetTarget binding point, among GL_ARRAY_BUFFER_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB, GL_PIXEL_UNPACK_BUFFER_ARB, GL_PIXEL_PACK_BUFFER_ARB.
void HdlGeBO::write ( const void *  data)

Write data to a Buffer Object with classical glBufferData method.

Parameters
dataThe data to write (must be the same size than the GeBO).

The documentation for this class was generated from the following files: