Open CASCADE Technology 7.8.0
Public Member Functions
OpenGl_VertexBufferEditor< theVec_t > Class Template Reference

Auxiliary class to iteratively modify data of existing VBO. It provides iteration interface with delayed CPU->GPU memory transfer to avoid slow per-element data transfer. User should explicitly call Flush() method to ensure that all data is transferred to VBO. Temporary buffer on CPU side can be initialized with lesser capacity than VBO to allow re-usage of shared buffer with fixed size between VBOs. More...

#include <OpenGl_VertexBufferEditor.hxx>

Public Member Functions

 OpenGl_VertexBufferEditor (const Standard_Integer theTmpBufferLength=0)
 Creates empty editor theTmpBufferLength [in] temporary buffer length.
 
 OpenGl_VertexBufferEditor (theVec_t *theTmpBuffer, const Standard_Integer theTmpBufferLength)
 Creates empty editor theTmpBuffer [in] pointer to temporary buffer theTmpBufferLength [in] temporary buffer length.
 
Standard_Boolean Init (const Handle< OpenGl_Context > &theGlCtx, const Handle< OpenGl_Buffer > &theVbo)
 Initialize editor for specified buffer object. theGlCtx [in] bound OpenGL context to edit buffer object theVbo [in] buffer to edit.
 
theVec_tValue ()
 Modify current element in VBO.
 
Standard_Boolean Next ()
 Move to the next position in VBO.
 
Standard_Boolean Flush ()
 Push current data from local buffer to VBO.
 
const Handle< OpenGl_Buffer > & GetVBO () const
 

Detailed Description

template<typename theVec_t>
class OpenGl_VertexBufferEditor< theVec_t >

Auxiliary class to iteratively modify data of existing VBO. It provides iteration interface with delayed CPU->GPU memory transfer to avoid slow per-element data transfer. User should explicitly call Flush() method to ensure that all data is transferred to VBO. Temporary buffer on CPU side can be initialized with lesser capacity than VBO to allow re-usage of shared buffer with fixed size between VBOs.

You should use NCollection_Vec2/NCollection_Vec3/NCollection_Vec4 with appropriate length to instantiate this template and access elements in VBO.

Notice that this technique designed for VBO streaming scenarios (when VBO is modified from time to time). Also this class doesn't retrieve existing data from VBO - data transferred only in one direction! In case of static data this is preferred to upload it within one call during VBO initialization.

Constructor & Destructor Documentation

◆ OpenGl_VertexBufferEditor() [1/2]

Creates empty editor theTmpBufferLength [in] temporary buffer length.

◆ OpenGl_VertexBufferEditor() [2/2]

template<typename theVec_t >
OpenGl_VertexBufferEditor< theVec_t >::OpenGl_VertexBufferEditor ( theVec_t theTmpBuffer,
const Standard_Integer  theTmpBufferLength 
)
inline

Creates empty editor theTmpBuffer [in] pointer to temporary buffer theTmpBufferLength [in] temporary buffer length.

Member Function Documentation

◆ Flush()

Push current data from local buffer to VBO.

◆ GetVBO()

template<typename theVec_t >
const Handle< OpenGl_Buffer > & OpenGl_VertexBufferEditor< theVec_t >::GetVBO ( ) const
inline
Returns
assigned VBO

◆ Init()

template<typename theVec_t >
Standard_Boolean OpenGl_VertexBufferEditor< theVec_t >::Init ( const Handle< OpenGl_Context > &  theGlCtx,
const Handle< OpenGl_Buffer > &  theVbo 
)
inline

Initialize editor for specified buffer object. theGlCtx [in] bound OpenGL context to edit buffer object theVbo [in] buffer to edit.

◆ Next()

Move to the next position in VBO.

◆ Value()

template<typename theVec_t >
theVec_t & OpenGl_VertexBufferEditor< theVec_t >::Value ( )
inline

Modify current element in VBO.


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