Open CASCADE Technology  7.3.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 - temporary buffer length. More...
 
 OpenGl_VertexBufferEditor (theVec_t *theTmpBuffer, const Standard_Integer theTmpBufferLength)
 Creates empty editor theTmpBuffer - pointer to temporary buffer theTmpBufferLength - temporary buffer length. More...
 
Standard_Boolean Init (const Handle< OpenGl_Context > &theGlCtx, const Handle< OpenGl_VertexBuffer > &theVbo)
 Initialize editor for specified VBO. theGlCtx - bound OpenGL context to edit VBO theVbo - VBO to edit. More...
 
theVec_t & Value ()
 Modify current element in VBO. More...
 
Standard_Boolean Next ()
 Move to the next position in VBO. More...
 
Standard_Boolean Flush ()
 Push current data from local buffer to VBO. More...
 
const Handle< OpenGl_VertexBuffer > & 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]

template<typename theVec_t>
OpenGl_VertexBufferEditor< theVec_t >::OpenGl_VertexBufferEditor ( const Standard_Integer  theTmpBufferLength = 0)
inline

Creates empty editor theTmpBufferLength - 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 - pointer to temporary buffer theTmpBufferLength - temporary buffer length.

Member Function Documentation

◆ Flush()

template<typename theVec_t>
Standard_Boolean OpenGl_VertexBufferEditor< theVec_t >::Flush ( )
inline

Push current data from local buffer to VBO.

◆ GetVBO()

template<typename theVec_t>
const Handle< OpenGl_VertexBuffer >& 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_VertexBuffer > &  theVbo 
)
inline

Initialize editor for specified VBO. theGlCtx - bound OpenGL context to edit VBO theVbo - VBO to edit.

◆ Next()

template<typename theVec_t>
Standard_Boolean OpenGl_VertexBufferEditor< theVec_t >::Next ( void  )
inline

Move to the next position in VBO.

◆ Value()

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

Modify current element in VBO.


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