Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Attributes
OpenGl_TextureBuffer Class Reference

Texture Buffer Object. This is a special 1D texture that VBO-style initialized. The main differences from general 1D texture: More...

#include <OpenGl_TextureBuffer.hxx>

Inheritance diagram for OpenGl_TextureBuffer:
Inheritance graph
[legend]

Public Member Functions

 OpenGl_TextureBuffer ()
 Create uninitialized TBO.
 
 ~OpenGl_TextureBuffer () override
 Destroy object, will throw exception if GPU memory not released with Release() before.
 
unsigned int GetTarget () const override
 Override VBO target.
 
bool IsValid () const
 Returns true if TBO is valid. Notice that no any real GL call is performed!
 
void Release (OpenGl_Context *theGlCtx) override
 Destroy object - will release GPU memory if any.
 
bool Create (const occ::handle< OpenGl_Context > &theGlCtx) override
 Creates VBO and Texture names (ids) if not yet generated. Data should be initialized by another method.
 
bool Init (const occ::handle< OpenGl_Context > &theGlCtx, const unsigned int theComponentsNb, const int theElemsNb, const float *theData)
 Perform TBO initialization with specified data. Existing data will be deleted.
 
bool Init (const occ::handle< OpenGl_Context > &theGlCtx, const unsigned int theComponentsNb, const int theElemsNb, const unsigned int *theData)
 Perform TBO initialization with specified data. Existing data will be deleted.
 
bool Init (const occ::handle< OpenGl_Context > &theGlCtx, const unsigned int theComponentsNb, const int theElemsNb, const unsigned short *theData)
 Perform TBO initialization with specified data. Existing data will be deleted.
 
bool Init (const occ::handle< OpenGl_Context > &theGlCtx, const unsigned int theComponentsNb, const int theElemsNb, const uint8_t *theData)
 Perform TBO initialization with specified data. Existing data will be deleted.
 
void BindTexture (const occ::handle< OpenGl_Context > &theGlCtx, const Graphic3d_TextureUnit theTextureUnit) const
 Bind TBO to specified Texture Unit.
 
void UnbindTexture (const occ::handle< OpenGl_Context > &theGlCtx, const Graphic3d_TextureUnit theTextureUnit) const
 Unbind TBO.
 
unsigned int TextureId () const
 Returns name of TBO.
 
unsigned int TextureFormat () const
 Returns internal texture format.
 
- Public Member Functions inherited from OpenGl_Buffer
 OpenGl_Buffer ()
 Create uninitialized buffer.
 
 ~OpenGl_Buffer () override
 Destroy object.
 
virtual bool IsVirtual () const
 Return TRUE if this is a virtual (for backward compatibility) VBO object.
 
bool IsValid () const
 
unsigned int GetComponentsNb () const
 
int GetElemsNb () const
 
void SetElemsNb (int theNbElems)
 Overrides the number of vertex attributes / number of vertexes. It is up to user specifying this number correct (e.g. below initial value)!
 
unsigned int GetDataType () const
 
uint8_tGetDataOffset () const
 
virtual void Bind (const occ::handle< OpenGl_Context > &theGlCtx) const
 Bind this buffer object.
 
virtual void Unbind (const occ::handle< OpenGl_Context > &theGlCtx) const
 Unbind this buffer object.
 
bool Init (const occ::handle< OpenGl_Context > &theGlCtx, const unsigned int theComponentsNb, const int theElemsNb, const float *theData)
 Notice that buffer object will be unbound after this call.
 
bool Init (const occ::handle< OpenGl_Context > &theGlCtx, const unsigned int theComponentsNb, const int theElemsNb, const unsigned int *theData)
 Notice that buffer object will be unbound after this call.
 
bool Init (const occ::handle< OpenGl_Context > &theGlCtx, const unsigned int theComponentsNb, const int theElemsNb, const unsigned short *theData)
 Notice that buffer object will be unbound after this call.
 
bool Init (const occ::handle< OpenGl_Context > &theGlCtx, const unsigned int theComponentsNb, const int theElemsNb, const uint8_t *theData)
 Notice that buffer object will be unbound after this call.
 
bool SubData (const occ::handle< OpenGl_Context > &theGlCtx, const int theElemFrom, const int theElemsNb, const float *theData)
 Notice that buffer object will be unbound after this call. Function replaces portion of data within this buffer object using glBufferSubData(). The buffer object should be initialized before call.
 
bool GetSubData (const occ::handle< OpenGl_Context > &theGlCtx, const int theElemFrom, const int theElemsNb, float *theData)
 Read back buffer sub-range. Notice that buffer object will be unbound after this call. Function reads portion of data from this buffer object using glGetBufferSubData().
 
bool SubData (const occ::handle< OpenGl_Context > &theGlCtx, const int theElemFrom, const int theElemsNb, const unsigned int *theData)
 Notice that buffer object will be unbound after this call. Function replaces portion of data within this buffer object using glBufferSubData(). The buffer object should be initialized before call.
 
bool GetSubData (const occ::handle< OpenGl_Context > &theGlCtx, const int theElemFrom, const int theElemsNb, unsigned int *theData)
 Read back buffer sub-range. Notice that buffer object will be unbound after this call. Function reads portion of data from this buffer object using glGetBufferSubData().
 
bool SubData (const occ::handle< OpenGl_Context > &theGlCtx, const int theElemFrom, const int theElemsNb, const unsigned short *theData)
 Notice that buffer object will be unbound after this call. Function replaces portion of data within this buffer object using glBufferSubData(). The buffer object should be initialized before call.
 
bool GetSubData (const occ::handle< OpenGl_Context > &theGlCtx, const int theElemFrom, const int theElemsNb, unsigned short *theData)
 Read back buffer sub-range. Notice that buffer object will be unbound after this call. Function reads portion of data from this buffer object using glGetBufferSubData().
 
bool SubData (const occ::handle< OpenGl_Context > &theGlCtx, const int theElemFrom, const int theElemsNb, const uint8_t *theData)
 Notice that buffer object will be unbound after this call. Function replaces portion of data within this buffer object using glBufferSubData(). The buffer object should be initialized before call.
 
bool GetSubData (const occ::handle< OpenGl_Context > &theGlCtx, const int theElemFrom, const int theElemsNb, uint8_t *theData)
 Read back buffer sub-range. Notice that buffer object will be unbound after this call. Function reads portion of data from this buffer object using glGetBufferSubData().
 
size_t EstimatedDataSize () const override
 offset to data
 
virtual 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)
 Initialize buffer with new data.
 
bool init (const occ::handle< OpenGl_Context > &theGlCtx, const unsigned int theComponentsNb, const int theElemsNb, const void *theData, const unsigned int theDataType)
 Initialize buffer with new data.
 
virtual bool subData (const occ::handle< OpenGl_Context > &theGlCtx, const int theElemFrom, const int theElemsNb, const void *theData, const unsigned int theDataType)
 Update part of the buffer with new data.
 
virtual bool getSubData (const occ::handle< OpenGl_Context > &theGlCtx, const int theElemFrom, const int theElemsNb, void *theData, const unsigned int theDataType)
 Read back buffer sub-range.
 
void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const override
 Dumps the content of me into the stream.
 
- Public Member Functions inherited from OpenGl_Resource
 OpenGl_Resource ()
 Empty constructor.
 
 ~OpenGl_Resource () override
 Destructor. Inheritors should call Clean (NULL) within it.
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()=default
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
bool IsInstance (const char *const theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
bool IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
bool IsKind (const char *const theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
int GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
 
int DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Static Public Attributes

static const unsigned int NO_TEXTURE = 0
 Helpful constants.
 
- Static Public Attributes inherited from OpenGl_Buffer
static const unsigned int NO_BUFFER = 0
 Helpful constants.
 

Protected Attributes

unsigned int myTextureId
 texture id
 
unsigned int myTexFormat
 internal texture format
 
- Protected Attributes inherited from OpenGl_Buffer
uint8_tmyOffset
 offset to data
 
unsigned int myBufferId
 VBO name (index)
 
unsigned int myComponentsNb
 Number of components per generic vertex attribute, must be 1, 2, 3, or 4.
 
int myElemsNb
 Number of vertex attributes / number of vertices.
 
unsigned int myDataType
 Data type (GL_FLOAT, GL_UNSIGNED_INT, GL_UNSIGNED_BYTE etc.)
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 
- Static Public Member Functions inherited from OpenGl_Buffer
static TCollection_AsciiString FormatTarget (unsigned int theTarget)
 Format VBO target enumeration value.
 
static size_t sizeOfGlType (unsigned int theType)
 
- Static Public Member Functions inherited from Standard_Transient
static constexpr const charget_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 
- Protected Member Functions inherited from OpenGl_Buffer
void BindBufferBase (const occ::handle< OpenGl_Context > &theGlCtx, unsigned int theIndex)
 Binds a buffer object to an indexed buffer target. Wrapper for glBindBufferBase().
 
void UnbindBufferBase (const occ::handle< OpenGl_Context > &theGlCtx, unsigned int theIndex)
 Unbinds a buffer object from an indexed buffer target. Wrapper for glBindBufferBase().
 
void BindBufferRange (const occ::handle< OpenGl_Context > &theGlCtx, unsigned int theIndex, const intptr_t theOffset, const size_t theSize)
 Binds a buffer object to an indexed buffer target with specified offset and size. Wrapper for glBindBufferRange().
 

Detailed Description

Texture Buffer Object. This is a special 1D texture that VBO-style initialized. The main differences from general 1D texture:

Notice that though TBO is inherited from VBO this is to unify design user shouldn't cast it to base class and all really useful methods are declared in this class.

Constructor & Destructor Documentation

◆ OpenGl_TextureBuffer()

OpenGl_TextureBuffer::OpenGl_TextureBuffer ( )

Create uninitialized TBO.

◆ ~OpenGl_TextureBuffer()

OpenGl_TextureBuffer::~OpenGl_TextureBuffer ( )
override

Destroy object, will throw exception if GPU memory not released with Release() before.

Member Function Documentation

◆ BindTexture()

void OpenGl_TextureBuffer::BindTexture ( const occ::handle< OpenGl_Context > & theGlCtx,
const Graphic3d_TextureUnit theTextureUnit ) const

Bind TBO to specified Texture Unit.

◆ Create()

bool OpenGl_TextureBuffer::Create ( const occ::handle< OpenGl_Context > & theGlCtx)
overridevirtual

Creates VBO and Texture names (ids) if not yet generated. Data should be initialized by another method.

Reimplemented from OpenGl_Buffer.

◆ GetTarget()

unsigned int OpenGl_TextureBuffer::GetTarget ( ) const
overridevirtual

Override VBO target.

Implements OpenGl_Buffer.

◆ Init() [1/4]

bool OpenGl_TextureBuffer::Init ( const occ::handle< OpenGl_Context > & theGlCtx,
const unsigned int theComponentsNb,
const int theElemsNb,
const float * theData )

Perform TBO initialization with specified data. Existing data will be deleted.

◆ Init() [2/4]

bool OpenGl_TextureBuffer::Init ( const occ::handle< OpenGl_Context > & theGlCtx,
const unsigned int theComponentsNb,
const int theElemsNb,
const uint8_t * theData )

Perform TBO initialization with specified data. Existing data will be deleted.

◆ Init() [3/4]

bool OpenGl_TextureBuffer::Init ( const occ::handle< OpenGl_Context > & theGlCtx,
const unsigned int theComponentsNb,
const int theElemsNb,
const unsigned int * theData )

Perform TBO initialization with specified data. Existing data will be deleted.

◆ Init() [4/4]

bool OpenGl_TextureBuffer::Init ( const occ::handle< OpenGl_Context > & theGlCtx,
const unsigned int theComponentsNb,
const int theElemsNb,
const unsigned short * theData )

Perform TBO initialization with specified data. Existing data will be deleted.

◆ IsValid()

bool OpenGl_TextureBuffer::IsValid ( ) const
inline

Returns true if TBO is valid. Notice that no any real GL call is performed!

◆ Release()

void OpenGl_TextureBuffer::Release ( OpenGl_Context * theGlCtx)
overridevirtual

Destroy object - will release GPU memory if any.

Reimplemented from OpenGl_Buffer.

◆ TextureFormat()

unsigned int OpenGl_TextureBuffer::TextureFormat ( ) const
inline

Returns internal texture format.

◆ TextureId()

unsigned int OpenGl_TextureBuffer::TextureId ( ) const
inline

Returns name of TBO.

◆ UnbindTexture()

void OpenGl_TextureBuffer::UnbindTexture ( const occ::handle< OpenGl_Context > & theGlCtx,
const Graphic3d_TextureUnit theTextureUnit ) const

Unbind TBO.

Field Documentation

◆ myTexFormat

unsigned int OpenGl_TextureBuffer::myTexFormat
protected

internal texture format

◆ myTextureId

unsigned int OpenGl_TextureBuffer::myTextureId
protected

texture id

◆ NO_TEXTURE

const unsigned int OpenGl_TextureBuffer::NO_TEXTURE = 0
static

Helpful constants.


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