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

Class for rendering of arbitrary primitive array. More...

#include <OpenGl_PrimitiveArray.hxx>

Inheritance diagram for OpenGl_PrimitiveArray:
Inheritance graph
[legend]

Public Types

enum  { DRAW_MODE_NONE = -1 }
 OpenGL does not provide a constant for "none" draw mode. So we define our own one that does not conflict with GL constants and utilizes common GL invalid value. More...
 

Public Member Functions

 OpenGl_PrimitiveArray (const OpenGl_GraphicDriver *theDriver)
 Empty constructor.
 
 OpenGl_PrimitiveArray (const OpenGl_GraphicDriver *theDriver, const Graphic3d_TypeOfPrimitiveArray theType, const occ::handle< Graphic3d_IndexBuffer > &theIndices, const occ::handle< Graphic3d_Buffer > &theAttribs, const occ::handle< Graphic3d_BoundBuffer > &theBounds)
 Default constructor.
 
 ~OpenGl_PrimitiveArray () override
 Destructor.
 
void Render (const occ::handle< OpenGl_Workspace > &theWorkspace) const override
 Render primitives to the window.
 
void Release (OpenGl_Context *theContext) override
 Release OpenGL resources (VBOs)
 
size_t EstimatedDataSize () const override
 Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.
 
void UpdateDrawStats (Graphic3d_FrameStatsDataTmp &theStats, bool theIsDetailed) const override
 Increment draw calls statistics.
 
bool IsInitialized () const
 Return true if VBOs initialization has been performed. VBO initialization is performed during first Render() call. Notice that this flag does not indicate VBOs validity.
 
void Invalidate () const
 Invalidate VBO content without destruction.
 
int DrawMode () const
 
bool IsFillDrawMode () const override
 Return TRUE if primitive type generates shaded triangulation.
 
const occ::handle< Graphic3d_IndexBuffer > & Indices () const
 
const occ::handle< Graphic3d_Buffer > & Attributes () const
 
const occ::handle< Graphic3d_BoundBuffer > & Bounds () const
 
size_t GetUID () const
 Returns unique ID of primitive array.
 
void InitBuffers (const occ::handle< OpenGl_Context > &theContext, const Graphic3d_TypeOfPrimitiveArray theType, const occ::handle< Graphic3d_IndexBuffer > &theIndices, const occ::handle< Graphic3d_Buffer > &theAttribs, const occ::handle< Graphic3d_BoundBuffer > &theBounds)
 Initialize indices, attributes and bounds with new data.
 
const occ::handle< OpenGl_IndexBuffer > & IndexVbo () const
 Returns index VBO.
 
const occ::handle< OpenGl_VertexBuffer > & AttributesVbo () const
 Returns attributes VBO.
 
void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const override
 Dumps the content of me into the stream.
 
- Public Member Functions inherited from OpenGl_Element
 OpenGl_Element ()
 
virtual void UpdateMemStats (Graphic3d_FrameStatsDataTmp &theStats) const
 Increment memory usage statistics. Default implementation puts EstimatedDataSize() into Graphic3d_FrameStatsCounter_EstimatedBytesGeom.
 
virtual void SynchronizeAspects ()
 Update parameters of the drawable elements.
 

Protected Member Functions

bool buildVBO (const occ::handle< OpenGl_Context > &theCtx, const bool theToKeepData) const
 VBO initialization procedures.
 
void updateVBO (const occ::handle< OpenGl_Context > &theCtx) const
 Patch VBO sub-date within invalidated range.
 
void clearMemoryGL (const occ::handle< OpenGl_Context > &theGlCtx) const
 Release GL memory.
 
- Protected Member Functions inherited from OpenGl_Element
virtual ~OpenGl_Element ()
 

Protected Attributes

occ::handle< OpenGl_IndexBuffermyVboIndices
 
occ::handle< OpenGl_VertexBuffermyVboAttribs
 
occ::handle< Graphic3d_IndexBuffermyIndices
 
occ::handle< Graphic3d_BuffermyAttribs
 
occ::handle< Graphic3d_BoundBuffermyBounds
 
short myDrawMode
 
bool myIsFillType
 
bool myIsVboInit
 
size_t myUID
 Unique ID of primitive array.
 

Additional Inherited Members

- Static Public Member Functions inherited from OpenGl_Element
template<typename theResource_t >
static void Destroy (OpenGl_Context *theContext, theResource_t *&theElement)
 Pointer to the context is used because this method might be called when the context is already being destroyed and usage of a handle would be unsafe.
 

Detailed Description

Class for rendering of arbitrary primitive array.

Member Enumeration Documentation

◆ anonymous enum

OpenGL does not provide a constant for "none" draw mode. So we define our own one that does not conflict with GL constants and utilizes common GL invalid value.

Enumerator
DRAW_MODE_NONE 

Constructor & Destructor Documentation

◆ OpenGl_PrimitiveArray() [1/2]

OpenGl_PrimitiveArray::OpenGl_PrimitiveArray ( const OpenGl_GraphicDriver * theDriver)

Empty constructor.

◆ OpenGl_PrimitiveArray() [2/2]

OpenGl_PrimitiveArray::OpenGl_PrimitiveArray ( const OpenGl_GraphicDriver * theDriver,
const Graphic3d_TypeOfPrimitiveArray theType,
const occ::handle< Graphic3d_IndexBuffer > & theIndices,
const occ::handle< Graphic3d_Buffer > & theAttribs,
const occ::handle< Graphic3d_BoundBuffer > & theBounds )

Default constructor.

◆ ~OpenGl_PrimitiveArray()

OpenGl_PrimitiveArray::~OpenGl_PrimitiveArray ( )
override

Destructor.

Member Function Documentation

◆ Attributes()

const occ::handle< Graphic3d_Buffer > & OpenGl_PrimitiveArray::Attributes ( ) const
inline
Returns
attributes array

◆ AttributesVbo()

const occ::handle< OpenGl_VertexBuffer > & OpenGl_PrimitiveArray::AttributesVbo ( ) const
inline

Returns attributes VBO.

◆ Bounds()

const occ::handle< Graphic3d_BoundBuffer > & OpenGl_PrimitiveArray::Bounds ( ) const
inline
Returns
bounds array

◆ buildVBO()

bool OpenGl_PrimitiveArray::buildVBO ( const occ::handle< OpenGl_Context > & theCtx,
const bool theToKeepData ) const
protected

VBO initialization procedures.

Parameters
theCtxbound GL context
theToKeepDatawhen true, myAttribs will not be nullified after VBO creation

◆ clearMemoryGL()

void OpenGl_PrimitiveArray::clearMemoryGL ( const occ::handle< OpenGl_Context > & theGlCtx) const
protected

Release GL memory.

◆ DrawMode()

int OpenGl_PrimitiveArray::DrawMode ( ) const
inline
Returns
primitive type (GL_LINES, GL_TRIANGLES and others)

◆ DumpJson()

void OpenGl_PrimitiveArray::DumpJson ( Standard_OStream & theOStream,
int theDepth = -1 ) const
overridevirtual

Dumps the content of me into the stream.

Reimplemented from OpenGl_Element.

◆ EstimatedDataSize()

size_t OpenGl_PrimitiveArray::EstimatedDataSize ( ) const
overridevirtual

Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.

Reimplemented from OpenGl_Element.

◆ GetUID()

size_t OpenGl_PrimitiveArray::GetUID ( ) const
inline

Returns unique ID of primitive array.

◆ IndexVbo()

const occ::handle< OpenGl_IndexBuffer > & OpenGl_PrimitiveArray::IndexVbo ( ) const
inline

Returns index VBO.

◆ Indices()

const occ::handle< Graphic3d_IndexBuffer > & OpenGl_PrimitiveArray::Indices ( ) const
inline
Returns
indices array

◆ InitBuffers()

void OpenGl_PrimitiveArray::InitBuffers ( const occ::handle< OpenGl_Context > & theContext,
const Graphic3d_TypeOfPrimitiveArray theType,
const occ::handle< Graphic3d_IndexBuffer > & theIndices,
const occ::handle< Graphic3d_Buffer > & theAttribs,
const occ::handle< Graphic3d_BoundBuffer > & theBounds )

Initialize indices, attributes and bounds with new data.

◆ Invalidate()

void OpenGl_PrimitiveArray::Invalidate ( ) const
inline

Invalidate VBO content without destruction.

◆ IsFillDrawMode()

bool OpenGl_PrimitiveArray::IsFillDrawMode ( ) const
inlineoverridevirtual

Return TRUE if primitive type generates shaded triangulation.

Reimplemented from OpenGl_Element.

◆ IsInitialized()

bool OpenGl_PrimitiveArray::IsInitialized ( ) const
inline

Return true if VBOs initialization has been performed. VBO initialization is performed during first Render() call. Notice that this flag does not indicate VBOs validity.

◆ Release()

void OpenGl_PrimitiveArray::Release ( OpenGl_Context * theContext)
overridevirtual

Release OpenGL resources (VBOs)

Implements OpenGl_Element.

◆ Render()

void OpenGl_PrimitiveArray::Render ( const occ::handle< OpenGl_Workspace > & theWorkspace) const
overridevirtual

Render primitives to the window.

Implements OpenGl_Element.

◆ UpdateDrawStats()

void OpenGl_PrimitiveArray::UpdateDrawStats ( Graphic3d_FrameStatsDataTmp & theStats,
bool theIsDetailed ) const
overridevirtual

Increment draw calls statistics.

Reimplemented from OpenGl_Element.

◆ updateVBO()

void OpenGl_PrimitiveArray::updateVBO ( const occ::handle< OpenGl_Context > & theCtx) const
protected

Patch VBO sub-date within invalidated range.

Field Documentation

◆ myAttribs

occ::handle<Graphic3d_Buffer> OpenGl_PrimitiveArray::myAttribs
mutableprotected

◆ myBounds

occ::handle<Graphic3d_BoundBuffer> OpenGl_PrimitiveArray::myBounds
mutableprotected

◆ myDrawMode

short OpenGl_PrimitiveArray::myDrawMode
protected

◆ myIndices

occ::handle<Graphic3d_IndexBuffer> OpenGl_PrimitiveArray::myIndices
mutableprotected

◆ myIsFillType

bool OpenGl_PrimitiveArray::myIsFillType
mutableprotected

◆ myIsVboInit

bool OpenGl_PrimitiveArray::myIsVboInit
mutableprotected

◆ myUID

size_t OpenGl_PrimitiveArray::myUID
protected

Unique ID of primitive array.

◆ myVboAttribs

occ::handle<OpenGl_VertexBuffer> OpenGl_PrimitiveArray::myVboAttribs
mutableprotected

◆ myVboIndices

occ::handle<OpenGl_IndexBuffer> OpenGl_PrimitiveArray::myVboIndices
mutableprotected

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