MRPT  2.0.0
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 18 of file COpenGLBuffer.cpp.

References m_impl, and type().

Here is the call graph for this function:

◆ 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

Definition at line 70 of file COpenGLBuffer.h.

References m_impl.

Referenced by mrpt::opengl::CRenderizableShaderWireFrame::render(), mrpt::opengl::CRenderizableShaderText::render(), mrpt::opengl::CRenderizableShaderTriangles::render(), and mrpt::opengl::CRenderizableShaderPoints::render().

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

Here is the call graph for this function:

◆ destroy()

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

Automatically called upon destructor, no need for the user to call it in normal situations.

Definition at line 68 of file COpenGLBuffer.h.

References m_impl.

Referenced by mrpt::opengl::COpenGLBuffer::RAII_Impl::create(), mrpt::opengl::CRenderizableShaderText::freeOpenGLResources(), mrpt::opengl::CRenderizableShaderTexturedTriangles::freeOpenGLResources(), mrpt::opengl::CRenderizableShaderTriangles::freeOpenGLResources(), mrpt::opengl::CRenderizableShaderWireFrame::freeOpenGLResources(), mrpt::opengl::CRenderizableShaderPoints::freeOpenGLResources(), and mrpt::opengl::COpenGLBuffer::RAII_Impl::~RAII_Impl().

Here is the caller graph for this function:

◆ isCreated()

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

Definition at line 64 of file COpenGLBuffer.h.

References m_impl.

Referenced by createOnce().

Here is the caller graph for this function:

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

Here is the caller graph for this function:

◆ 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

Definition at line 49 of file COpenGLBuffer.h.

References m_impl.

Referenced by mrpt::opengl::COpenGLBuffer::RAII_Impl::allocate(), mrpt::opengl::COpenGLBuffer::RAII_Impl::bind(), COpenGLBuffer(), and mrpt::opengl::COpenGLBuffer::RAII_Impl::release().

Here is the caller graph for this function:

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

Here is the caller graph for this function:

Member Data Documentation

◆ m_impl

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



Page generated by Doxygen 1.8.14 for MRPT 2.0.0 Git: b38439d21 Tue Mar 31 19:58:06 2020 +0200 at miƩ abr 1 00:50:30 CEST 2020