Open CASCADE Technology 7.8.0
Data Structures | Public Member Functions
OpenGl_BackgroundArray Class Reference

Tool class for generating reusable data for gradient or texture background rendering. More...

#include <OpenGl_BackgroundArray.hxx>

Inheritance diagram for OpenGl_BackgroundArray:
Inheritance graph
[legend]

Data Structures

struct  OpenGl_GradientParameters
 

Public Member Functions

 OpenGl_BackgroundArray (const Graphic3d_TypeOfBackground theType)
 Main constructor.
 
void Render (const Handle< OpenGl_Workspace > &theWorkspace, Graphic3d_Camera::Projection theProjection) const
 Render primitives to the window.
 
bool IsDefined () const
 Check if background parameters are set properly.
 
void SetTextureParameters (const Aspect_FillMethod theFillMethod)
 Sets background texture parameters.
 
void SetTextureFillMethod (const Aspect_FillMethod theFillMethod)
 Sets texture fill method.
 
Aspect_FillMethod TextureFillMethod () const
 Gets background texture fill method.
 
Aspect_GradientFillMethod GradientFillMethod () const
 Gets background gradient fill method.
 
const OpenGl_Vec4GradientColor (const Standard_Integer theIndex) const
 Returns color of gradient background for the given index.
 
void SetGradientFillMethod (const Aspect_GradientFillMethod theType)
 Sets type of gradient fill method.
 
void SetGradientParameters (const Quantity_Color &theColor1, const Quantity_Color &theColor2, const Aspect_GradientFillMethod theType)
 Sets background gradient parameters.
 
- Public Member Functions inherited from OpenGl_PrimitiveArray
 OpenGl_PrimitiveArray (const OpenGl_GraphicDriver *theDriver)
 Empty constructor.
 
 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.
 
virtual ~OpenGl_PrimitiveArray ()
 Destructor.
 
virtual void Release (OpenGl_Context *theContext) override
 Release OpenGL resources (VBOs)
 
virtual Standard_Size EstimatedDataSize () const override
 Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.
 
virtual void UpdateDrawStats (Graphic3d_FrameStatsDataTmp &theStats, bool theIsDetailed) const override
 Increment draw calls statistics.
 
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.
 
void Invalidate () const
 Invalidate VBO content without destruction.
 
Standard_Integer DrawMode () const
 
virtual Standard_Boolean IsFillDrawMode () const override
 Return TRUE if primitive type generates shaded triangulation.
 
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.
 
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.
 
const Handle< OpenGl_IndexBuffer > & IndexVbo () const
 Returns index VBO.
 
const Handle< OpenGl_VertexBuffer > & AttributesVbo () const
 Returns attributes VBO.
 
virtual void DumpJson (Standard_OStream &theOStream, Standard_Integer 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.
 

Internal structure for storing gradient parameters

Graphic3d_TypeOfBackground myType
 Type of background: texture or gradient.
 
Aspect_FillMethod myFillMethod
 Texture parameters.
 
OpenGl_GradientParameters myGradientParams
 Gradient parameters.
 
Standard_Integer myViewWidth
 view width used for array initialization
 
Standard_Integer myViewHeight
 view height used for array initialization
 
Standard_Boolean myToUpdate
 Shows if array parameters were changed and data (myAttribs storage) is to be updated.
 
Standard_Boolean init (const Handle< OpenGl_Workspace > &theWorkspace) const
 Fill attributes arrays for background array according to its type:
 
Standard_Boolean createGradientArray (const Handle< OpenGl_Context > &theCtx) const
 Initializes gradient arrays.
 
Standard_Boolean createTextureArray (const Handle< OpenGl_Workspace > &theWorkspace) const
 Initializes texture arrays.
 
Standard_Boolean createCubeMapArray () const
 Initializes cubemap arrays.
 
void invalidateData ()
 Marks array parameters as changed, on next rendering stage array data is to be updated.
 
virtual void Render (const Handle< OpenGl_Workspace > &theWorkspace) const override
 Render primitives to the window.
 

Additional Inherited Members

- Public Types inherited from OpenGl_PrimitiveArray
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...
 
- 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.
 
- Protected Member Functions inherited from OpenGl_PrimitiveArray
Standard_Boolean buildVBO (const Handle< OpenGl_Context > &theCtx, const Standard_Boolean theToKeepData) const
 VBO initialization procedures.
 
void updateVBO (const Handle< OpenGl_Context > &theCtx) const
 Patch VBO sub-date within invalidated range.
 
void clearMemoryGL (const Handle< OpenGl_Context > &theGlCtx) const
 Release GL memory.
 
- Protected Member Functions inherited from OpenGl_Element
virtual ~OpenGl_Element ()
 
- Protected Attributes inherited from OpenGl_PrimitiveArray
Handle< OpenGl_IndexBuffermyVboIndices
 
Handle< OpenGl_VertexBuffermyVboAttribs
 
Handle< Graphic3d_IndexBuffermyIndices
 
Handle< Graphic3d_BuffermyAttribs
 
Handle< Graphic3d_BoundBuffermyBounds
 
short myDrawMode
 
Standard_Boolean myIsFillType
 
Standard_Boolean myIsVboInit
 
Standard_Size myUID
 Unique ID of primitive array.
 

Detailed Description

Tool class for generating reusable data for gradient or texture background rendering.

Constructor & Destructor Documentation

◆ OpenGl_BackgroundArray()

OpenGl_BackgroundArray::OpenGl_BackgroundArray ( const Graphic3d_TypeOfBackground  theType)

Main constructor.

Member Function Documentation

◆ createCubeMapArray()

Standard_Boolean OpenGl_BackgroundArray::createCubeMapArray ( ) const
protected

Initializes cubemap arrays.

◆ createGradientArray()

Standard_Boolean OpenGl_BackgroundArray::createGradientArray ( const Handle< OpenGl_Context > &  theCtx) const
protected

Initializes gradient arrays.

◆ createTextureArray()

Standard_Boolean OpenGl_BackgroundArray::createTextureArray ( const Handle< OpenGl_Workspace > &  theWorkspace) const
protected

Initializes texture arrays.

Parameters
theWorkspaceOpenGl workspace that stores texture in the current enabled face aspect.

◆ GradientColor()

const OpenGl_Vec4 & OpenGl_BackgroundArray::GradientColor ( const Standard_Integer  theIndex) const
inline

Returns color of gradient background for the given index.

◆ GradientFillMethod()

Aspect_GradientFillMethod OpenGl_BackgroundArray::GradientFillMethod ( ) const
inline

Gets background gradient fill method.

◆ init()

Standard_Boolean OpenGl_BackgroundArray::init ( const Handle< OpenGl_Workspace > &  theWorkspace) const
protected

Fill attributes arrays for background array according to its type:

  • for gradient background its attributes consist of colors and gradient coordinates
  • for texture one its attributes consist of position and texture coordinates.

◆ invalidateData()

void OpenGl_BackgroundArray::invalidateData ( )
protected

Marks array parameters as changed, on next rendering stage array data is to be updated.

◆ IsDefined()

bool OpenGl_BackgroundArray::IsDefined ( ) const

Check if background parameters are set properly.

◆ Render() [1/2]

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

Render primitives to the window.

Reimplemented from OpenGl_PrimitiveArray.

◆ Render() [2/2]

void OpenGl_BackgroundArray::Render ( const Handle< OpenGl_Workspace > &  theWorkspace,
Graphic3d_Camera::Projection  theProjection 
) const

Render primitives to the window.

◆ SetGradientFillMethod()

void OpenGl_BackgroundArray::SetGradientFillMethod ( const Aspect_GradientFillMethod  theType)

Sets type of gradient fill method.

◆ SetGradientParameters()

void OpenGl_BackgroundArray::SetGradientParameters ( const Quantity_Color theColor1,
const Quantity_Color theColor2,
const Aspect_GradientFillMethod  theType 
)

Sets background gradient parameters.

◆ SetTextureFillMethod()

void OpenGl_BackgroundArray::SetTextureFillMethod ( const Aspect_FillMethod  theFillMethod)

Sets texture fill method.

◆ SetTextureParameters()

void OpenGl_BackgroundArray::SetTextureParameters ( const Aspect_FillMethod  theFillMethod)

Sets background texture parameters.

◆ TextureFillMethod()

Aspect_FillMethod OpenGl_BackgroundArray::TextureFillMethod ( ) const
inline

Gets background texture fill method.

Field Documentation

◆ myFillMethod

Aspect_FillMethod OpenGl_BackgroundArray::myFillMethod
protected

Texture parameters.

◆ myGradientParams

OpenGl_GradientParameters OpenGl_BackgroundArray::myGradientParams
mutableprotected

Gradient parameters.

◆ myToUpdate

Standard_Boolean OpenGl_BackgroundArray::myToUpdate
mutableprotected

Shows if array parameters were changed and data (myAttribs storage) is to be updated.

◆ myType

Graphic3d_TypeOfBackground OpenGl_BackgroundArray::myType
protected

Type of background: texture or gradient.

◆ myViewHeight

Standard_Integer OpenGl_BackgroundArray::myViewHeight
mutableprotected

view height used for array initialization

◆ myViewWidth

Standard_Integer OpenGl_BackgroundArray::myViewWidth
mutableprotected

view width used for array initialization


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