Visualization Library 2.0.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes | List of all members
vl::BufferObject Class Reference

The BufferObject class is a Buffer that can upload its data on the GPU memory. More...

#include <BufferObject.hpp>

+ Inheritance diagram for vl::BufferObject:

Public Member Functions

 BufferObject ()
 
 BufferObject (const BufferObject &other)
 
BufferObjectoperator= (const BufferObject &other)
 
void swap (BufferObject &other)
 
 ~BufferObject ()
 
void setHandle (unsigned int handle)
 
unsigned int handle () const
 
GLsizeiptr byteCountBufferObject () const
 
void createBufferObject ()
 
void deleteBufferObject ()
 
void downloadBufferObject ()
 
void setBufferData (EBufferObjectUsage usage, bool discard_local_storage=false)
 
void setBufferData (GLsizeiptr byte_count, const GLvoid *data, EBufferObjectUsage usage)
 
void setBufferSubData (GLintptr offset=0, GLsizeiptr byte_count=-1, bool discard_local_storage=false)
 
void setBufferSubData (GLintptr offset, GLsizeiptr byte_count, const GLvoid *data)
 
void * mapBufferObject (EBufferObjectAccess access)
 
bool unmapBufferObject ()
 
EBufferObjectUsage usage () const
 BufferObject usage flag as specified by setBufferData(). More...
 
- Public Member Functions inherited from vl::Buffer
 Buffer ()
 
 Buffer (const Buffer &other)
 
Bufferoperator= (const Buffer &other)
 
void swap (Buffer &other)
 
 ~Buffer ()
 
void clear ()
 
void resize (size_t byte_count, size_t alignment=0)
 
void setUserAllocatedBuffer (void *ptr, size_t bytes)
 Uses a user-allocated buffer as storage. More...
 
void setAllocationMode (EAllocationMode mode)
 
EAllocationMode allocationMode () const
 
size_t bytesUsed () const
 
bool empty () const
 
unsigned char * ptr ()
 
const unsigned char * ptr () const
 
size_t alignment () const
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

Protected Attributes

unsigned int mHandle
 
GLsizeiptr mByteCountBufferObject
 
EBufferObjectUsage mUsage
 
- Protected Attributes inherited from vl::Buffer
unsigned char * mPtr
 
size_t mByteCount
 
size_t mAlignment
 
EAllocationMode mAllocationMode
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Public Types inherited from vl::Buffer
enum  EAllocationMode { UserAllocatedBuffer, AutoAllocatedBuffer }
 
- Static Public Member Functions inherited from vl::Buffer
static void * alignedMalloc (size_t bytes, size_t alignment)
 
static void alignedFree (void *ptr)
 
- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

The BufferObject class is a Buffer that can upload its data on the GPU memory.

Remarks
BufferObject is the storage used by ArrayAbstract and subclasses like ArrayFloat3, ArrayUByte4 etc.

Definition at line 55 of file BufferObject.hpp.

Constructor & Destructor Documentation

◆ BufferObject() [1/2]

vl::BufferObject::BufferObject ( )
inline

Definition at line 60 of file BufferObject.hpp.

References vl::BU_STATIC_DRAW, mByteCountBufferObject, mHandle, and mUsage.

◆ BufferObject() [2/2]

vl::BufferObject::BufferObject ( const BufferObject other)
inline

Definition at line 68 of file BufferObject.hpp.

References vl::BU_STATIC_DRAW, mByteCountBufferObject, mHandle, and mUsage.

◆ ~BufferObject()

vl::BufferObject::~BufferObject ( )
inline

Definition at line 105 of file BufferObject.hpp.

References deleteBufferObject().

Member Function Documentation

◆ byteCountBufferObject()

GLsizeiptr vl::BufferObject::byteCountBufferObject ( ) const
inline

◆ createBufferObject()

void vl::BufferObject::createBufferObject ( )
inline

◆ deleteBufferObject()

void vl::BufferObject::deleteBufferObject ( )
inline

◆ downloadBufferObject()

void vl::BufferObject::downloadBufferObject ( )
inline

◆ handle()

unsigned int vl::BufferObject::handle ( ) const
inline

◆ mapBufferObject()

void* vl::BufferObject::mapBufferObject ( EBufferObjectAccess  access)
inline

◆ operator=()

BufferObject& vl::BufferObject::operator= ( const BufferObject other)
inline

Definition at line 79 of file BufferObject.hpp.

References deleteBufferObject().

◆ setBufferData() [1/2]

void vl::BufferObject::setBufferData ( EBufferObjectUsage  usage,
bool  discard_local_storage = false 
)
inline

◆ setBufferData() [2/2]

void vl::BufferObject::setBufferData ( GLsizeiptr  byte_count,
const GLvoid *  data,
EBufferObjectUsage  usage 
)
inline

◆ setBufferSubData() [1/2]

void vl::BufferObject::setBufferSubData ( GLintptr  offset = 0,
GLsizeiptr  byte_count = -1,
bool  discard_local_storage = false 
)
inline

Definition at line 187 of file BufferObject.hpp.

References byteCountBufferObject(), vl::Buffer::clear(), and vl::Buffer::ptr().

◆ setBufferSubData() [2/2]

void vl::BufferObject::setBufferSubData ( GLintptr  offset,
GLsizeiptr  byte_count,
const GLvoid *  data 
)
inline

Definition at line 198 of file BufferObject.hpp.

References handle(), vl::Has_BufferObject, VL_CHECK, and VL_CHECK_OGL.

◆ setHandle()

void vl::BufferObject::setHandle ( unsigned int  handle)
inline

Definition at line 110 of file BufferObject.hpp.

References handle(), and mHandle.

◆ swap()

void vl::BufferObject::swap ( BufferObject other)
inline

Definition at line 87 of file BufferObject.hpp.

References mByteCountBufferObject, mHandle, mUsage, and vl::Buffer::swap().

◆ unmapBufferObject()

bool vl::BufferObject::unmapBufferObject ( )
inline

◆ usage()

EBufferObjectUsage vl::BufferObject::usage ( ) const
inline

BufferObject usage flag as specified by setBufferData().

Definition at line 259 of file BufferObject.hpp.

References mUsage.

Referenced by vl::readPixels(), and setBufferData().

Member Data Documentation

◆ mByteCountBufferObject

GLsizeiptr vl::BufferObject::mByteCountBufferObject
protected

◆ mHandle

unsigned int vl::BufferObject::mHandle
protected

◆ mUsage

EBufferObjectUsage vl::BufferObject::mUsage
protected

Definition at line 264 of file BufferObject.hpp.

Referenced by BufferObject(), setBufferData(), swap(), and usage().


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