Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
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.
 
 ~OpenGl_BufferCompatT () override
 Destroy object.
 
bool IsVirtual () const override
 Return TRUE.
 
bool Create (const occ::handle< OpenGl_Context > &theGlCtx) override
 Creates VBO name (id) if not yet generated. Data should be initialized by another method.
 
void Release (OpenGl_Context *theGlCtx) override
 Destroy object - will release memory if any.
 
void Bind (const occ::handle< OpenGl_Context > &) const override
 Bind this VBO.
 
void Unbind (const occ::handle< OpenGl_Context > &) const override
 Unbind this VBO.
 

advanced methods

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

occ::handle< NCollection_BuffermyData
 buffer data
 
bool initLink (const occ::handle< NCollection_Buffer > &theData, const unsigned int theComponentsNb, const int theElemsNb, const unsigned int theDataType)
 buffer data
 
bool init (const occ::handle< OpenGl_Context > &theGlCtx, const unsigned int theComponentsNb, const int theElemsNb, const void *theData, const unsigned int theDataType, const int theStride) override
 Initialize buffer with new data (data will be copied).
 
bool subData (const occ::handle< OpenGl_Context > &theGlCtx, const int theElemFrom, const int theElemsNb, const void *theData, const unsigned int theDataType) override
 Update part of the buffer with new data.
 
bool getSubData (const occ::handle< OpenGl_Context > &theGlCtx, const int theElemFrom, const int 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 >
OpenGl_BufferCompatT< BaseBufferT >::~OpenGl_BufferCompatT ( )
inlineoverride

Destroy object.

Member Function Documentation

◆ Bind()

template<class BaseBufferT >
void OpenGl_BufferCompatT< BaseBufferT >::Bind ( const occ::handle< OpenGl_Context > & ) const
inlineoverride

Bind this VBO.

◆ Create()

template<class BaseBufferT >
bool OpenGl_BufferCompatT< BaseBufferT >::Create ( const occ::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 occ::handle< OpenGl_Context > & theGlCtx,
const int theElemFrom,
const int theElemsNb,
void * theData,
const unsigned int theDataType )
inlineoverride

Read back buffer sub-range.

◆ init()

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

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

◆ initLink()

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

buffer data

◆ IsVirtual()

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

Return TRUE.

◆ Release()

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

Destroy object - will release memory if any.

◆ subData()

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

Update part of the buffer with new data.

◆ Unbind()

template<class BaseBufferT >
void OpenGl_BufferCompatT< BaseBufferT >::Unbind ( const occ::handle< OpenGl_Context > & ) const
inlineoverride

Unbind this VBO.

Field Documentation

◆ myData

template<class BaseBufferT >
occ::handle<NCollection_Buffer> OpenGl_BufferCompatT< BaseBufferT >::myData
protected

buffer data


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