kanzi::GLBufferHandle Class Reference

GLBufferHandle manages RAII ownership for GL buffer object. More...

#include <kanzi/core.ui/platform/graphics_backend/gl/gl_buffer_handle.hpp>

Public Member Functions

 GLBufferHandle ()
 Constructs an empty GLBufferHandle which does not own any GL buffer object. More...
 
 GLBufferHandle (Renderer *renderer)
 Creates a new GL buffer object with renderer and constructs a GLBufferHandle which owns it. More...
 
 ~GLBufferHandle ()
 
 GLBufferHandle (Renderer *renderer, unsigned int handle, bool takeOwnership)
 Creates a wrapper for pre-existing GL buffer object. More...
 
unsigned int release ()
 Releases the ownership of the GL buffer if any. More...
 
 GLBufferHandle (KZ_RV_REF(GLBufferHandle) other)
 
GLBufferHandleoperator= (KZ_RV_REF(GLBufferHandle) other)
 
unsigned int get () const
 Returns GL handle to the buffer object, or 0 if no GL buffer is owned. More...
 
void reset ()
 Destroys the GL buffer object currently managed by the GLBufferHandle (if any) More...
 
 operator bool_type () const
 

Friends

void swap (GLBufferHandle &left, GLBufferHandle &right)
 

Detailed Description

GLBufferHandle manages RAII ownership for GL buffer object.

Constructor & Destructor Documentation

kanzi::GLBufferHandle::GLBufferHandle ( )
explicit

Constructs an empty GLBufferHandle which does not own any GL buffer object.

kanzi::GLBufferHandle::GLBufferHandle ( Renderer renderer)
explicit

Creates a new GL buffer object with renderer and constructs a GLBufferHandle which owns it.

Parameters
rendererRenderer
kanzi::GLBufferHandle::~GLBufferHandle ( )
kanzi::GLBufferHandle::GLBufferHandle ( Renderer renderer,
unsigned int  handle,
bool  takeOwnership 
)
explicit

Creates a wrapper for pre-existing GL buffer object.

If takeOwnership is true, the GL buffer object is externally managed, and it will not be deleted when the handle is destroyed.

Parameters
rendererRenderer
handlePre-existing GL buffer object name
takeOwnershipShould newly created GLBufferHandle take ownership of the GL buffer object
kanzi::GLBufferHandle::GLBufferHandle ( KZ_RV_REF(GLBufferHandle other)
inline

Member Function Documentation

unsigned int kanzi::GLBufferHandle::release ( )

Releases the ownership of the GL buffer if any.

get() returns 0 after the call.

Returns
Handle to the GL buffer object
GLBufferHandle& kanzi::GLBufferHandle::operator= ( KZ_RV_REF(GLBufferHandle other)
inline
unsigned int kanzi::GLBufferHandle::get ( ) const
inline

Returns GL handle to the buffer object, or 0 if no GL buffer is owned.

void kanzi::GLBufferHandle::reset ( )

Destroys the GL buffer object currently managed by the GLBufferHandle (if any)

kanzi::GLBufferHandle::operator bool_type ( ) const
inline

Friends And Related Function Documentation

void swap ( GLBufferHandle left,
GLBufferHandle right 
)
friend

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