reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

ofBufferObject Class Reference

#include <ofBufferObject.h>

Public Member Functions

 ofBufferObject ()
 
void allocate ()
 
void allocate (GLsizeiptr bytes, GLenum usage)
 
void allocate (GLsizeiptr bytes, const void *data, GLenum usage)
 
template<typename T >
void allocate (const std::vector< T > &data, GLenum usage)
 
template<typename T >
void allocate (const ofPixels_< T > &data, GLenum usage)
 
bool isAllocated () const
 true if allocate was called before
 
void bind (GLenum target) const
 glBindBuffer: https://www.opengl.org/sdk/docs/man4/html/glBindBuffer.xhtml
 
void unbind (GLenum target) const
 binds the passed target to buffer 0
 
void bindBase (GLenum target, GLuint index) const
 glBindBufferBase: https://www.opengl.org/sdk/docs/man4/html/glBindBufferBase.xhtml
 
void unbindBase (GLenum target, GLuint index) const
 binds the given target and index to buffer 0
 
void bindRange (GLenum target, GLuint index, GLintptr offset, GLsizeiptr size) const
 glBindBufferRange: https://www.opengl.org/sdk/docs/man4/html/glBindBufferRange.xhtml
 
void unbindRange (GLenum target, GLuint index) const
 binds the given target and index to 0
 
GLuint getId () const
 returns the id of the buffer if it's allocated or 0 otherwise
 
void setData (GLsizeiptr bytes, const void *data, GLenum usage)
 
void updateData (GLintptr offset, GLsizeiptr bytes, const void *data)
 
void updateData (GLsizeiptr bytes, const void *data)
 
template<typename T >
void setData (const std::vector< T > &data, GLenum usage)
 
template<typename T >
void setData (const ofPixels_< T > &data, GLenum usage)
 
template<typename T >
void updateData (GLintptr offset, const std::vector< T > &data)
 
template<typename T >
void updateData (const std::vector< T > &data)
 
void * map (GLenum access)
 
void unmap ()
 
template<typename T >
T * map (GLenum access)
 
void * mapRange (GLintptr offset, GLsizeiptr length, GLenum access)
 
void unmapRange ()
 same as unmap, just to make the api more clear
 
template<typename T >
T * mapRange (GLintptr offset, GLsizeiptr length, GLenum access)
 
void copyTo (ofBufferObject &dstBuffer) const
 
void copyTo (ofBufferObject &dstBuffer, int readOffset, int writeOffset, size_t size) const
 
void invalidate ()
 
GLsizeiptr size () const
 

Constructor & Destructor Documentation

◆ ofBufferObject()

ofBufferObject::ofBufferObject ( )

Member Function Documentation

◆ allocate() [1/5]

void ofBufferObject::allocate ( )

creates a buffer without allocating any memory yet glGenBuffers, allocates a GL buffer

◆ allocate() [2/5]

template<typename T >
void ofBufferObject::allocate ( const ofPixels_< T > &  data,
GLenum  usage 
)
inline

◆ allocate() [3/5]

template<typename T >
void ofBufferObject::allocate ( const std::vector< T > &  data,
GLenum  usage 
)
inline

◆ allocate() [4/5]

void ofBufferObject::allocate ( GLsizeiptr  bytes,
const void *  data,
GLenum  usage 
)

◆ allocate() [5/5]

void ofBufferObject::allocate ( GLsizeiptr  bytes,
GLenum  usage 
)

creates a buffer and allocates the required number of bytes glGenBuffers + glNamedBufferData: https://www.opengl.org/sdk/docs/man4/html/glBufferData.xhtml before GL 4.5 emulates glNamedBufferData by binding to last known target for this buffer uploading data to that target and unbinding again

◆ bind()

void ofBufferObject::bind ( GLenum  target) const

◆ bindBase()

void ofBufferObject::bindBase ( GLenum  target,
GLuint  index 
) const

◆ bindRange()

void ofBufferObject::bindRange ( GLenum  target,
GLuint  index,
GLintptr  offset,
GLsizeiptr  size 
) const

◆ copyTo() [1/2]

void ofBufferObject::copyTo ( ofBufferObject dstBuffer) const

◆ copyTo() [2/2]

void ofBufferObject::copyTo ( ofBufferObject dstBuffer,
int  readOffset,
int  writeOffset,
size_t  size 
) const

◆ getId()

GLuint ofBufferObject::getId ( ) const

returns the id of the buffer if it's allocated or 0 otherwise

◆ invalidate()

void ofBufferObject::invalidate ( )

◆ isAllocated()

bool ofBufferObject::isAllocated ( ) const

true if allocate was called before

◆ map() [1/2]

void * ofBufferObject::map ( GLenum  access)

glMapNamedBuffer: https://www.opengl.org/sdk/docs/man4/html/glMapBuffer.xhtml before GL 4.5 emulates glMapNamedBuffer by binding to last known target for this buffer and mapping that target

-----—| invariant: direct state access is not available

◆ map() [2/2]

template<typename T >
T * ofBufferObject::map ( GLenum  access)
inline

typed version of map, returns an array of T when used like: buffer.map<Type>(access)

◆ mapRange() [1/2]

void * ofBufferObject::mapRange ( GLintptr  offset,
GLsizeiptr  length,
GLenum  access 
)

glMapNamedBufferRange: https://www.opengl.org/sdk/docs/man4/html/glMapBufferRange.xhtml before GL 4.5 emulates glMapNamedBufferRange by binding to last known target for this buffer and mapping that target

-----—| invariant: direct state access is not available

◆ mapRange() [2/2]

template<typename T >
T * ofBufferObject::mapRange ( GLintptr  offset,
GLsizeiptr  length,
GLenum  access 
)
inline

typed version of mapRange, returns an array of T when used like: buffer.mapRange<Type>(access)

◆ setData() [1/3]

template<typename T >
void ofBufferObject::setData ( const ofPixels_< T > &  data,
GLenum  usage 
)
inline

◆ setData() [2/3]

template<typename T >
void ofBufferObject::setData ( const std::vector< T > &  data,
GLenum  usage 
)
inline

typed version of setData, same functionality but guesses the size from the size of the passed vector and size of the type

◆ setData() [3/3]

void ofBufferObject::setData ( GLsizeiptr  bytes,
const void *  data,
GLenum  usage 
)

glNamedBufferData: https://www.opengl.org/sdk/docs/man4/html/glBufferData.xhtml before GL 4.5 emulates glNamedBufferData by binding to last known target for this buffer uploading data to that target and unbinding again

-----—| invariant: direct state access is not available

◆ size()

GLsizeiptr ofBufferObject::size ( ) const

◆ unbind()

void ofBufferObject::unbind ( GLenum  target) const

binds the passed target to buffer 0

◆ unbindBase()

void ofBufferObject::unbindBase ( GLenum  target,
GLuint  index 
) const

binds the given target and index to buffer 0

◆ unbindRange()

void ofBufferObject::unbindRange ( GLenum  target,
GLuint  index 
) const

binds the given target and index to 0

◆ unmap()

void ofBufferObject::unmap ( )

glUnmapNamedBuffer: https://www.opengl.org/sdk/docs/man4/html/glUnmapBuffer.xhtml before GL 4.5 emulates glUnmapNamedBuffer by unmapping and unbinding the last known target for this buffer

-----—| invariant: direct state access is not available

◆ unmapRange()

void ofBufferObject::unmapRange ( )

same as unmap, just to make the api more clear

◆ updateData() [1/4]

template<typename T >
void ofBufferObject::updateData ( const std::vector< T > &  data)
inline

typed version of updateData, same functionality but guesses the size from the size of the passed vector and size of the type

◆ updateData() [2/4]

template<typename T >
void ofBufferObject::updateData ( GLintptr  offset,
const std::vector< T > &  data 
)
inline

typed version of updateData, same functionality but guesses the size from the size of the passed vector and size of the type

◆ updateData() [3/4]

void ofBufferObject::updateData ( GLintptr  offset,
GLsizeiptr  bytes,
const void *  data 
)

glNamedBufferSubData: https://www.opengl.org/sdk/docs/man4/html/glBufferSubData.xhtml before GL 4.5 emulates glNamedBufferSubData by binding to last known target for this buffer uploading data to that target and unbinding again

-----—| invariant: direct state access is not available

◆ updateData() [4/4]

void ofBufferObject::updateData ( GLsizeiptr  bytes,
const void *  data 
)

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