Cinder  0.9.1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cinder::gl::Pbo Class Reference

#include <Pbo.h>

Inherits cinder::gl::BufferObj.

Public Member Functions

void bind () const
 
void unbind () const
 
void bufferData (GLsizeiptr size, const GLvoid *data, GLenum usage)
 
void bufferSubData (GLintptr offset, GLsizeiptr size, const GLvoid *data)
 
void getBufferSubData (GLintptr offset, GLsizeiptr size, GLvoid *data)
 
void copyData (GLsizeiptr size, const GLvoid *data)
 
void ensureMinimumSize (GLsizeiptr minimumSize)
 
void * map (GLenum access) const
 
void * mapWriteOnly ()
 
void * mapReplace ()
 
void * mapBufferRange (GLintptr offset, GLsizeiptr length, GLbitfield access) const
 
void unmap () const
 
GLuint getId () const
 
size_t getSize () const
 
GLenum getTarget () const
 
void setTarget (GLenum target)
 
GLenum getUsage () const
 
void setUsage (GLenum usage)
 
const std::string & getLabel () const
 
void setLabel (const std::string &label)
 

Static Public Member Functions

static PboRef create (GLenum target)
 
static PboRef create (GLenum target, GLsizeiptr allocationSize, const void *data=nullptr, GLenum usage=GL_STATIC_DRAW)
 
static GLuint getBindingConstantForTarget (GLenum target)
 

Protected Member Functions

 Pbo (GLenum target)
 
 Pbo (GLenum target, GLsizeiptr allocationSize, const void *data=nullptr, GLenum usage=GL_STATIC_DRAW)
 

Protected Attributes

GLuint mId
 
size_t mSize
 
GLenum mTarget
 
GLenum mUsage
 
std::string mLabel
 

Detailed Description

Represents an OpenGL Pixel Buffer Object.

Constructor & Destructor Documentation

cinder::gl::Pbo::Pbo ( GLenum  target)
protected
cinder::gl::Pbo::Pbo ( GLenum  target,
GLsizeiptr  allocationSize,
const void *  data = nullptr,
GLenum  usage = GL_STATIC_DRAW 
)
protected

Member Function Documentation

PboRef cinder::gl::Pbo::create ( GLenum  target)
static

Creates a PBO with no memory allocated.

PboRef cinder::gl::Pbo::create ( GLenum  target,
GLsizeiptr  allocationSize,
const void *  data = nullptr,
GLenum  usage = GL_STATIC_DRAW 
)
static

Creates a PBO at target (generally GL_PIXEL_PACK_BUFFER or GL_PIXEL_UNPACK_BUFFER), with storage for allocationSize bytes, and filled with data data if it is not NULL.

void cinder::gl::BufferObj::bind ( ) const
inherited
void cinder::gl::BufferObj::unbind ( ) const
inherited
void cinder::gl::BufferObj::bufferData ( GLsizeiptr  size,
const GLvoid *  data,
GLenum  usage 
)
inherited

Analogous to glBufferData()

void cinder::gl::BufferObj::bufferSubData ( GLintptr  offset,
GLsizeiptr  size,
const GLvoid *  data 
)
inherited

Analogous to glBufferSubData()

void cinder::gl::BufferObj::getBufferSubData ( GLintptr  offset,
GLsizeiptr  size,
GLvoid *  data 
)
inherited

Returns some or all of the data from the buffer object currently bound for this objects target.

void cinder::gl::BufferObj::copyData ( GLsizeiptr  size,
const GLvoid *  data 
)
inherited

Calls bufferSubData when the size is adequate, otherwise calls bufferData, forcing a reallocation of the data store.

void cinder::gl::BufferObj::ensureMinimumSize ( GLsizeiptr  minimumSize)
inherited

Reallocates the buffer if its size is smaller than minimumSize. This destroys the contents of the buffer if it must be reallocated.

void * cinder::gl::BufferObj::map ( GLenum  access) const
inherited

Analogous to glMapBuffer(). access must be GL_READ_ONLY, GL_WRITE_ONLY, or GL_READ_WRITE. On iOS ES 2 only GL_WRITE_ONLY_OES is valid.

void * cinder::gl::BufferObj::mapWriteOnly ( )
inherited

Maps the Buffer for writing, but does not invalidate the Buffer's existing contents. Slower than mapReplace(). Abstracts glMapBuffer() vs. glMapBufferRange() with appropriate write-only parameters for the platform.

void * cinder::gl::BufferObj::mapReplace ( )
inherited

Invalidates the Buffer's existing contents and maps it for writing. Preferable to mapWriteOnly() when invalidation is acceptable. Abstracts glMapBuffer() vs. glMapBufferRange() with appropriate write-only parameters for the platform.

void * cinder::gl::BufferObj::mapBufferRange ( GLintptr  offset,
GLsizeiptr  length,
GLbitfield  access 
) const
inherited

Analogous to glMapBufferRange(). On iOS ES 2 only GL_WRITE_ONLY_OES is valid.

void cinder::gl::BufferObj::unmap ( ) const
inherited
GLuint cinder::gl::BufferObj::getId ( ) const
inherited
size_t cinder::gl::BufferObj::getSize ( ) const
inherited
GLenum cinder::gl::BufferObj::getTarget ( ) const
inherited
void cinder::gl::BufferObj::setTarget ( GLenum  target)
inherited
GLenum cinder::gl::BufferObj::getUsage ( ) const
inherited
void cinder::gl::BufferObj::setUsage ( GLenum  usage)
inherited
GLuint cinder::gl::BufferObj::getBindingConstantForTarget ( GLenum  target)
staticinherited

Returns the appropriate parameter to glGetIntegerv() for a specific target; ie GL_ARRAY_BUFFER -> GL_ARRAY_BUFFER_BINDING. Returns 0 on failure.

const std::string& cinder::gl::BufferObj::getLabel ( ) const
inherited

Returns the debugging label associated with the Buffer.

void cinder::gl::BufferObj::setLabel ( const std::string &  label)
inherited

Sets the debugging label associated with the Buffer. Calls glObjectLabel() when available.

Member Data Documentation

GLuint cinder::gl::BufferObj::mId
protectedinherited
size_t cinder::gl::BufferObj::mSize
protectedinherited
GLenum cinder::gl::BufferObj::mTarget
protectedinherited
GLenum cinder::gl::BufferObj::mUsage
protectedinherited
std::string cinder::gl::BufferObj::mLabel
protectedinherited

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