Open CASCADE Technology 7.8.0
Public Member Functions
OpenGl_BufferCompatT< BaseBufferT > Class Template Reference

Compatibility layer for old OpenGL without VBO. Make sure to pass pointer from GetDataOffset() instead of NULL. Method GetDataOffset() returns pointer to real data in this class (while base class OpenGl_VertexBuffer always return NULL). More...

#include <OpenGl_BufferCompatT.hxx>

Inheritance diagram for OpenGl_BufferCompatT< BaseBufferT >:
Inheritance graph
[legend]

Public Member Functions

 OpenGl_BufferCompatT ()
 Create uninitialized VBO.
 
virtual ~OpenGl_BufferCompatT ()
 Destroy object.
 
virtual bool IsVirtual () const override
 Return TRUE.
 
bool Create (const Handle< OpenGl_Context > &theGlCtx) override
 Creates VBO name (id) if not yet generated. Data should be initialized by another method.
 
virtual void Release (OpenGl_Context *theGlCtx) override
 Destroy object - will release memory if any.
 
virtual void Bind (const Handle< OpenGl_Context > &) const override
 Bind this VBO.
 
virtual void Unbind (const Handle< OpenGl_Context > &) const override
 Unbind this VBO.
 

advanced methods

Handle< NCollection_BuffermyData
 buffer data
 
bool initLink (const Handle< NCollection_Buffer > &theData, const unsigned int theComponentsNb, const Standard_Integer theElemsNb, const unsigned int theDataType)
 Initialize buffer with existing data. Data will NOT be copied by this method!
 
virtual bool init (const Handle< OpenGl_Context > &theGlCtx, const unsigned int theComponentsNb, const Standard_Integer theElemsNb, const void *theData, const unsigned int theDataType, const Standard_Integer theStride) override
 Initialize buffer with new data (data will be copied).
 
virtual bool subData (const Handle< OpenGl_Context > &theGlCtx, const Standard_Integer theElemFrom, const Standard_Integer theElemsNb, const void *theData, const unsigned int theDataType) override
 Update part of the buffer with new data.
 
virtual bool getSubData (const Handle< OpenGl_Context > &theGlCtx, const Standard_Integer theElemFrom, const Standard_Integer theElemsNb, void *theData, const unsigned int theDataType) override
 Read back buffer sub-range.
 

Detailed Description

template<class BaseBufferT>
class OpenGl_BufferCompatT< BaseBufferT >

Compatibility layer for old OpenGL without VBO. Make sure to pass pointer from GetDataOffset() instead of NULL. Method GetDataOffset() returns pointer to real data in this class (while base class OpenGl_VertexBuffer always return NULL).

Methods Bind()/Unbind() do nothing (do not affect OpenGL state) and ::GetTarget() is never used. For this reason there is no analog for OpenGl_IndexBuffer. Just pass GetDataOffset() to glDrawElements() directly as last argument.

Class overrides methods init() and subData() to copy data into own memory buffer. Extra method initLink() might be used to pass existing buffer through handle without copying the data.

Method Create() creates dummy identifier for this object which should NOT be passed to OpenGL functions.

Constructor & Destructor Documentation

◆ OpenGl_BufferCompatT()

template<class BaseBufferT >
OpenGl_BufferCompatT< BaseBufferT >::OpenGl_BufferCompatT ( )
inline

Create uninitialized VBO.

◆ ~OpenGl_BufferCompatT()

template<class BaseBufferT >
virtual OpenGl_BufferCompatT< BaseBufferT >::~OpenGl_BufferCompatT ( )
inlinevirtual

Destroy object.

Member Function Documentation

◆ Bind()

template<class BaseBufferT >
virtual void OpenGl_BufferCompatT< BaseBufferT >::Bind ( const Handle< OpenGl_Context > &  ) const
inlineoverridevirtual

Bind this VBO.

◆ Create()

template<class BaseBufferT >
bool OpenGl_BufferCompatT< BaseBufferT >::Create ( const Handle< OpenGl_Context > &  theGlCtx)
inlineoverride

Creates VBO name (id) if not yet generated. Data should be initialized by another method.

◆ getSubData()

template<class BaseBufferT >
bool OpenGl_BufferCompatT< BaseBufferT >::getSubData ( const Handle< OpenGl_Context > &  theGlCtx,
const Standard_Integer  theElemFrom,
const Standard_Integer  theElemsNb,
void *  theData,
const unsigned int  theDataType 
)
inlineoverridevirtual

Read back buffer sub-range.

◆ init()

template<class BaseBufferT >
bool OpenGl_BufferCompatT< BaseBufferT >::init ( const Handle< OpenGl_Context > &  theGlCtx,
const unsigned int  theComponentsNb,
const Standard_Integer  theElemsNb,
const void *  theData,
const unsigned int  theDataType,
const Standard_Integer  theStride 
)
inlineoverridevirtual

Initialize buffer with new data (data will be copied).

◆ initLink()

template<class BaseBufferT >
bool OpenGl_BufferCompatT< BaseBufferT >::initLink ( const Handle< NCollection_Buffer > &  theData,
const unsigned int  theComponentsNb,
const Standard_Integer  theElemsNb,
const unsigned int  theDataType 
)
inline

Initialize buffer with existing data. Data will NOT be copied by this method!

◆ IsVirtual()

template<class BaseBufferT >
virtual bool OpenGl_BufferCompatT< BaseBufferT >::IsVirtual ( ) const
inlineoverridevirtual

Return TRUE.

◆ Release()

template<class BaseBufferT >
void OpenGl_BufferCompatT< BaseBufferT >::Release ( OpenGl_Context theGlCtx)
inlineoverridevirtual

Destroy object - will release memory if any.

◆ subData()

template<class BaseBufferT >
bool OpenGl_BufferCompatT< BaseBufferT >::subData ( const Handle< OpenGl_Context > &  theGlCtx,
const Standard_Integer  theElemFrom,
const Standard_Integer  theElemsNb,
const void *  theData,
const unsigned int  theDataType 
)
inlineoverridevirtual

Update part of the buffer with new data.

◆ Unbind()

template<class BaseBufferT >
virtual void OpenGl_BufferCompatT< BaseBufferT >::Unbind ( const Handle< OpenGl_Context > &  ) const
inlineoverridevirtual

Unbind this VBO.

Field Documentation

◆ myData

template<class BaseBufferT >
Handle< NCollection_Buffer > OpenGl_BufferCompatT< BaseBufferT >::myData
protected

buffer data


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