MRPT  2.0.4
List of all members | Classes | Public Types | Public Member Functions | Private Attributes
mrpt::opengl::COpenGLBuffer Class Reference

Detailed Description

A wrapper for an OpenGL buffer object.

Refer to docs for glGenBuffers() and glBufferData().

Definition at line 21 of file COpenGLBuffer.h.

#include <mrpt/opengl/COpenGLBuffer.h>

Classes

struct  RAII_Impl
 

Public Types

enum  Type : unsigned int { Type::Vertex = 0x8892, Type::ElementIndex = 0x8893, Type::PixelPack = 0x88EB, Type::PixelUnpack = 0x88EC }
 
enum  Usage : unsigned int {
  Usage::StreamDraw = 0x88E0, Usage::StreamRead = 0x88E1, Usage::StreamCopy = 0x88E2, Usage::StaticDraw = 0x88E4,
  Usage::StaticRead = 0x88E5, Usage::StaticCopy = 0x88E6, Usage::DynamicDraw = 0x88E8, Usage::DynamicRead = 0x88E9,
  Usage::DynamicCopy = 0x88EA
}
 

Public Member Functions

 COpenGLBuffer (const Type type)
 
 COpenGLBuffer ()
 
 ~COpenGLBuffer ()=default
 
Type type () const
 
Usage usage () const
 
void setUsage (const Usage u)
 
void create ()
 Actually create the buffer, destroying any previously existing buffer. More...
 
void createOnce ()
 Calls create() only if the buffer has not been created yet. More...
 
bool isCreated () const
 
void destroy ()
 Automatically called upon destructor, no need for the user to call it in normal situations. More...
 
void bind ()
 
void release ()
 
unsigned int bufferId () const
 
void allocate (const void *data, int byteCount)
 Reserves byteCount bytes in the buffer and copy to it the provided data. More...
 

Private Attributes

std::shared_ptr< RAII_Implm_impl
 

Member Enumeration Documentation

◆ Type

enum mrpt::opengl::COpenGLBuffer::Type : unsigned int
strong
Enumerator
Vertex 
ElementIndex 
PixelPack 
PixelUnpack 

Definition at line 24 of file COpenGLBuffer.h.

◆ Usage

enum mrpt::opengl::COpenGLBuffer::Usage : unsigned int
strong
Enumerator
StreamDraw 
StreamRead 
StreamCopy 
StaticDraw 
StaticRead 
StaticCopy 
DynamicDraw 
DynamicRead 
DynamicCopy 

Definition at line 32 of file COpenGLBuffer.h.

Constructor & Destructor Documentation

◆ COpenGLBuffer() [1/2]

COpenGLBuffer::COpenGLBuffer ( const Type  type)
explicit

Definition at line 23 of file COpenGLBuffer.cpp.

References m_impl, and type().

◆ COpenGLBuffer() [2/2]

mrpt::opengl::COpenGLBuffer::COpenGLBuffer ( )
inline

Definition at line 46 of file COpenGLBuffer.h.

◆ ~COpenGLBuffer()

mrpt::opengl::COpenGLBuffer::~COpenGLBuffer ( )
default

Member Function Documentation

◆ allocate()

void mrpt::opengl::COpenGLBuffer::allocate ( const void *  data,
int  byteCount 
)
inline

Reserves byteCount bytes in the buffer and copy to it the provided data.

create() and bind() must be called before using this method.

Definition at line 78 of file COpenGLBuffer.h.

References mrpt::opengl::internal::data, and m_impl.

◆ bind()

void mrpt::opengl::COpenGLBuffer::bind ( )
inline

◆ bufferId()

unsigned int mrpt::opengl::COpenGLBuffer::bufferId ( ) const
inline

Definition at line 73 of file COpenGLBuffer.h.

References m_impl.

◆ create()

void mrpt::opengl::COpenGLBuffer::create ( )
inline

Actually create the buffer, destroying any previously existing buffer.

Call after setting the type and usage.

See also
allocate()

Definition at line 57 of file COpenGLBuffer.h.

References m_impl.

Referenced by createOnce().

◆ createOnce()

void mrpt::opengl::COpenGLBuffer::createOnce ( )
inline

Calls create() only if the buffer has not been created yet.

Definition at line 60 of file COpenGLBuffer.h.

References create(), and isCreated().

◆ destroy()

void mrpt::opengl::COpenGLBuffer::destroy ( )
inline

◆ isCreated()

bool mrpt::opengl::COpenGLBuffer::isCreated ( ) const
inline

Definition at line 64 of file COpenGLBuffer.h.

References m_impl.

Referenced by createOnce().

◆ release()

void mrpt::opengl::COpenGLBuffer::release ( )
inline

Definition at line 71 of file COpenGLBuffer.h.

References m_impl.

Referenced by mrpt::opengl::COpenGLBuffer::RAII_Impl::destroy().

◆ setUsage()

void mrpt::opengl::COpenGLBuffer::setUsage ( const Usage  u)
inline

Definition at line 52 of file COpenGLBuffer.h.

References m_impl.

◆ type()

Type mrpt::opengl::COpenGLBuffer::type ( ) const
inline

◆ usage()

Usage mrpt::opengl::COpenGLBuffer::usage ( ) const
inline

Definition at line 51 of file COpenGLBuffer.h.

References m_impl.

Referenced by mrpt::opengl::COpenGLBuffer::RAII_Impl::allocate().

Member Data Documentation

◆ m_impl

std::shared_ptr<RAII_Impl> mrpt::opengl::COpenGLBuffer::m_impl
private



Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Sun Jul 19 15:15:43 UTC 2020