Open CASCADE Technology  7.3.0
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. More...
 
 OpenGl_PrimitiveArray (const OpenGl_GraphicDriver *theDriver, const Graphic3d_TypeOfPrimitiveArray theType, const Handle< Graphic3d_IndexBuffer > &theIndices, const Handle< Graphic3d_Buffer > &theAttribs, const Handle< Graphic3d_BoundBuffer > &theBounds)
 Default constructor. More...
 
virtual ~OpenGl_PrimitiveArray ()
 Destructor. More...
 
virtual void Render (const Handle< OpenGl_Workspace > &theWorkspace) const override
 Render primitives to the window. More...
 
virtual void Release (OpenGl_Context *theContext) override
 Release OpenGL resources (VBOs) More...
 
Standard_Boolean 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. More...
 
void Invalidate () const
 Invalidate VBO content without destruction. More...
 
GLint DrawMode () const
 
virtual Standard_Boolean IsFillDrawMode () const override
 Return TRUE if primitive type generates shaded triangulation. More...
 
const Handle< Graphic3d_IndexBuffer > & Indices () const
 
const Handle< Graphic3d_Buffer > & Attributes () const
 
const Handle< Graphic3d_BoundBuffer > & Bounds () const
 
Standard_Size GetUID () const
 Returns unique ID of primitive array. More...
 
void InitBuffers (const Handle< OpenGl_Context > &theContext, const Graphic3d_TypeOfPrimitiveArray theType, const Handle< Graphic3d_IndexBuffer > &theIndices, const Handle< Graphic3d_Buffer > &theAttribs, const Handle< Graphic3d_BoundBuffer > &theBounds)
 Initialize indices, attributes and bounds with new data. More...
 
const Handle< OpenGl_VertexBuffer > & IndexVbo () const
 Returns index VBO. More...
 
const Handle< OpenGl_VertexBuffer > & AttributesVbo () const
 Returns attributes VBO. More...
 
- Public Member Functions inherited from OpenGl_Element
 OpenGl_Element ()
 
Standard_Boolean RenderFiltered (const Handle< OpenGl_Workspace > &theWorkspace, const Handle< OpenGl_RenderFilter > &theFilter) const
 Render element if it passes the filtering procedure. This method should be used for elements which can be used in scope of rendering algorithms. E.g. elements of groups during recursive rendering. If render filter is null, pure rendering is performed. More...
 

Protected Member Functions

Standard_Boolean buildVBO (const Handle< OpenGl_Context > &theCtx, const Standard_Boolean theToKeepData) const
 VBO initialization procedures. More...
 
void clearMemoryGL (const Handle< OpenGl_Context > &theGlCtx) const
 
- Protected Member Functions inherited from OpenGl_Element
virtual ~OpenGl_Element ()
 

Protected Attributes

Handle< OpenGl_VertexBuffermyVboIndices
 
Handle< OpenGl_VertexBuffermyVboAttribs
 
Handle< Graphic3d_IndexBuffermyIndices
 
Handle< Graphic3d_BuffermyAttribs
 
Handle< Graphic3d_BoundBuffermyBounds
 
GLshort myDrawMode
 
Standard_Boolean myIsFillType
 
Standard_Boolean myIsVboInit
 
Standard_Size myUID
 Unique ID of primitive array. More...
 

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. More...
 

Detailed Description

Class for rendering of arbitrary primitive array.

Member Enumeration Documentation

◆ anonymous enum

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 Handle< Graphic3d_IndexBuffer > &  theIndices,
const Handle< Graphic3d_Buffer > &  theAttribs,
const Handle< Graphic3d_BoundBuffer > &  theBounds 
)

Default constructor.

◆ ~OpenGl_PrimitiveArray()

virtual OpenGl_PrimitiveArray::~OpenGl_PrimitiveArray ( )
virtual

Destructor.

Member Function Documentation

◆ Attributes()

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

◆ AttributesVbo()

const Handle< OpenGl_VertexBuffer >& OpenGl_PrimitiveArray::AttributesVbo ( ) const
inline

Returns attributes VBO.

◆ Bounds()

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

◆ buildVBO()

Standard_Boolean OpenGl_PrimitiveArray::buildVBO ( const Handle< OpenGl_Context > &  theCtx,
const Standard_Boolean  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 Handle< OpenGl_Context > &  theGlCtx) const
protected

◆ DrawMode()

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

◆ GetUID()

Standard_Size OpenGl_PrimitiveArray::GetUID ( ) const
inline

Returns unique ID of primitive array.

◆ IndexVbo()

const Handle< OpenGl_VertexBuffer >& OpenGl_PrimitiveArray::IndexVbo ( ) const
inline

Returns index VBO.

◆ Indices()

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

◆ InitBuffers()

void OpenGl_PrimitiveArray::InitBuffers ( const Handle< OpenGl_Context > &  theContext,
const Graphic3d_TypeOfPrimitiveArray  theType,
const Handle< Graphic3d_IndexBuffer > &  theIndices,
const Handle< Graphic3d_Buffer > &  theAttribs,
const 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()

virtual Standard_Boolean OpenGl_PrimitiveArray::IsFillDrawMode ( ) const
inlineoverridevirtual

Return TRUE if primitive type generates shaded triangulation.

Reimplemented from OpenGl_Element.

◆ IsInitialized()

Standard_Boolean 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()

virtual void OpenGl_PrimitiveArray::Release ( OpenGl_Context theContext)
overridevirtual

Release OpenGL resources (VBOs)

Implements OpenGl_Element.

◆ Render()

virtual void OpenGl_PrimitiveArray::Render ( const Handle< OpenGl_Workspace > &  theWorkspace) const
overridevirtual

Render primitives to the window.

Implements OpenGl_Element.

Reimplemented in OpenGl_BackgroundArray.

Field Documentation

◆ myAttribs

Handle< Graphic3d_Buffer > OpenGl_PrimitiveArray::myAttribs
mutableprotected

◆ myBounds

Handle< Graphic3d_BoundBuffer > OpenGl_PrimitiveArray::myBounds
mutableprotected

◆ myDrawMode

GLshort OpenGl_PrimitiveArray::myDrawMode
protected

◆ myIndices

Handle< Graphic3d_IndexBuffer > OpenGl_PrimitiveArray::myIndices
mutableprotected

◆ myIsFillType

Standard_Boolean OpenGl_PrimitiveArray::myIsFillType
mutableprotected

◆ myIsVboInit

Standard_Boolean OpenGl_PrimitiveArray::myIsVboInit
mutableprotected

◆ myUID

Standard_Size OpenGl_PrimitiveArray::myUID
protected

Unique ID of primitive array.

◆ myVboAttribs

Handle< OpenGl_VertexBuffer > OpenGl_PrimitiveArray::myVboAttribs
mutableprotected

◆ myVboIndices

Handle< OpenGl_VertexBuffer > OpenGl_PrimitiveArray::myVboIndices
mutableprotected

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