Open CASCADE Technology 7.8.2.dev
OpenGl_Workspace Class Reference

Rendering workspace. Provides methods to render primitives and maintain GL state. More...

#include <OpenGl_Workspace.hxx>

Inheritance diagram for OpenGl_Workspace:

Public Member Functions

 OpenGl_Workspace (OpenGl_View *theView, const Handle< OpenGl_Window > &theWindow)
 Constructor of rendering workspace.
 
virtual ~OpenGl_Workspace ()
 Destructor.
 
Standard_Boolean Activate ()
 Activate rendering context.
 
OpenGl_ViewView () const
 
const Handle< OpenGl_Context > & GetGlContext ()
 
Handle< OpenGl_FrameBufferFBOCreate (const Standard_Integer theWidth, const Standard_Integer theHeight)
 
void FBORelease (Handle< OpenGl_FrameBuffer > &theFbo)
 
Standard_Boolean BufferDump (const Handle< OpenGl_FrameBuffer > &theFbo, Image_PixMap &theImage, const Graphic3d_BufferType &theBufferType)
 
Standard_Integer Width () const
 
Standard_Integer Height () const
 
Standard_Boolean SetUseZBuffer (const Standard_Boolean theToUse)
 Setup Z-buffer usage flag (without affecting GL state!). Returns previously set flag.
 
Standard_BooleanUseZBuffer ()
 
Standard_BooleanUseDepthWrite ()
 
Graphic3d_PolygonOffset SetDefaultPolygonOffset (const Graphic3d_PolygonOffset &theOffset)
 Configure default polygon offset parameters. Return previous settings.
 
bool ToAllowFaceCulling () const
 Return true if active group might activate face culling (e.g. primitives are closed).
 
bool SetAllowFaceCulling (bool theToAllow)
 Allow or disallow face culling. This call does NOT affect current state of back face culling; ApplyAspectFace() should be called to update state.
 
bool ToHighlight () const
 Return true if following structures should apply highlight color.
 
const Handle< Graphic3d_PresentationAttributes > & HighlightStyle () const
 Return highlight style.
 
void SetHighlightStyle (const Handle< Graphic3d_PresentationAttributes > &theStyle)
 Set highlight style.
 
const OpenGl_Vec4EdgeColor () const
 Return edge color taking into account highlight flag.
 
const OpenGl_Vec4InteriorColor () const
 Return Interior color taking into account highlight flag.
 
const OpenGl_Vec4TextColor () const
 Return text color taking into account highlight flag.
 
const OpenGl_Vec4TextSubtitleColor () const
 Return text Subtitle color taking into account highlight flag.
 
const OpenGl_AspectsAspects () const
 Currently set aspects (can differ from applied).
 
const OpenGl_AspectsSetAspects (const OpenGl_Aspects *theAspect)
 Assign new aspects (will be applied within ApplyAspects()).
 
const Handle< OpenGl_TextureSet > & TextureSet () const
 Return TextureSet from set Aspects or Environment texture.
 
const OpenGl_AspectsApplyAspects (bool theToBindTextures=true)
 Apply aspects.
 
void ResetAppliedAspect ()
 Clear the applied aspect state to default values.
 
Standard_Integer RenderFilter () const
 Get rendering filter.
 
void SetRenderFilter (Standard_Integer theFilter)
 Set filter for restricting rendering of particular elements.
 
bool ShouldRender (const OpenGl_Element *theElement, const OpenGl_Group *theGroup)
 Checks whether the element can be rendered or not.
 
Standard_Integer NbSkippedTransparentElements ()
 Return the number of skipped transparent elements within active OpenGl_RenderFilter_OpaqueOnly filter.
 
void ResetSkippedCounter ()
 Reset skipped transparent elements counter.
 
const OpenGl_AspectsNoneCulling () const
 Returns face aspect for none culling mode.
 
const OpenGl_AspectsFrontCulling () const
 Returns face aspect for front face culling mode.
 
void SetEnvironmentTexture (const Handle< OpenGl_TextureSet > &theTexture)
 Sets a new environment texture.
 
const Handle< OpenGl_TextureSet > & EnvironmentTexture () const
 Returns environment texture.
 
void DumpJson (Standard_OStream &theOStream, Standard_Integer theDepth=-1) const
 Dumps the content of me into the stream.
 
- 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 ()
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
Standard_Boolean 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.
 
Standard_Boolean IsKind (const Standard_CString 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.
 
Standard_Integer GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object.
 
Standard_Integer DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Protected Attributes

protected fields
OpenGl_ViewmyView
 
Handle< OpenGl_WindowmyWindow
 
Handle< OpenGl_ContextmyGlContext
 
Standard_Boolean myUseZBuffer
 
Standard_Boolean myUseDepthWrite
 
OpenGl_Aspects myNoneCulling
 
OpenGl_Aspects myFrontCulling
 
fields related to status
Standard_Integer myNbSkippedTranspElems
 counter of skipped transparent elements for OpenGl_LayerList two rendering passes method
 
Standard_Integer myRenderFilter
 active filter for skipping rendering of elements by some criteria (multiple render passes)
 
OpenGl_Aspects myDefaultAspects
 counter of skipped transparent elements for OpenGl_LayerList two rendering passes method
 
const OpenGl_AspectsmyAspectsSet
 counter of skipped transparent elements for OpenGl_LayerList two rendering passes method
 
Handle< Graphic3d_AspectsmyAspectsApplied
 counter of skipped transparent elements for OpenGl_LayerList two rendering passes method
 
Handle< Graphic3d_PresentationAttributesmyAspectFaceAppliedWithHL
 counter of skipped transparent elements for OpenGl_LayerList two rendering passes method
 
bool myToAllowFaceCulling
 allow back face culling
 
Handle< Graphic3d_PresentationAttributesmyHighlightStyle
 active highlight style
 
OpenGl_Aspects myAspectFaceHl
 Hiddenline aspect.
 
Handle< OpenGl_TextureSetmyEnvironmentTexture
 counter of skipped transparent elements for OpenGl_LayerList two rendering passes method
 

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 Standard_Transient
static constexpr const char * get_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.
 

Detailed Description

Rendering workspace. Provides methods to render primitives and maintain GL state.

Constructor & Destructor Documentation

◆ OpenGl_Workspace()

OpenGl_Workspace::OpenGl_Workspace ( OpenGl_View * theView,
const Handle< OpenGl_Window > & theWindow )

Constructor of rendering workspace.

◆ ~OpenGl_Workspace()

virtual OpenGl_Workspace::~OpenGl_Workspace ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ Activate()

Standard_Boolean OpenGl_Workspace::Activate ( )

Activate rendering context.

◆ ApplyAspects()

const OpenGl_Aspects * OpenGl_Workspace::ApplyAspects ( bool theToBindTextures = true)

Apply aspects.

Parameters
theToBindTexturesflag to bind texture set defined by applied aspect
Returns
aspect set by SetAspects()

◆ Aspects()

const OpenGl_Aspects * OpenGl_Workspace::Aspects ( ) const
inline

Currently set aspects (can differ from applied).

◆ BufferDump()

Standard_Boolean OpenGl_Workspace::BufferDump ( const Handle< OpenGl_FrameBuffer > & theFbo,
Image_PixMap & theImage,
const Graphic3d_BufferType & theBufferType )

◆ DumpJson()

void OpenGl_Workspace::DumpJson ( Standard_OStream & theOStream,
Standard_Integer theDepth = -1 ) const

Dumps the content of me into the stream.

◆ EdgeColor()

const OpenGl_Vec4 & OpenGl_Workspace::EdgeColor ( ) const
inline

Return edge color taking into account highlight flag.

◆ EnvironmentTexture()

const Handle< OpenGl_TextureSet > & OpenGl_Workspace::EnvironmentTexture ( ) const
inline

Returns environment texture.

◆ FBOCreate()

Handle< OpenGl_FrameBuffer > OpenGl_Workspace::FBOCreate ( const Standard_Integer theWidth,
const Standard_Integer theHeight )

◆ FBORelease()

void OpenGl_Workspace::FBORelease ( Handle< OpenGl_FrameBuffer > & theFbo)

◆ FrontCulling()

const OpenGl_Aspects & OpenGl_Workspace::FrontCulling ( ) const
inline

Returns face aspect for front face culling mode.

◆ GetGlContext()

const Handle< OpenGl_Context > & OpenGl_Workspace::GetGlContext ( )
inline

◆ Height()

Standard_Integer OpenGl_Workspace::Height ( ) const

◆ HighlightStyle()

const Handle< Graphic3d_PresentationAttributes > & OpenGl_Workspace::HighlightStyle ( ) const
inline

Return highlight style.

◆ InteriorColor()

const OpenGl_Vec4 & OpenGl_Workspace::InteriorColor ( ) const
inline

Return Interior color taking into account highlight flag.

◆ NbSkippedTransparentElements()

Standard_Integer OpenGl_Workspace::NbSkippedTransparentElements ( )
inline

Return the number of skipped transparent elements within active OpenGl_RenderFilter_OpaqueOnly filter.

See also
OpenGl_LayerList::Render()

◆ NoneCulling()

const OpenGl_Aspects & OpenGl_Workspace::NoneCulling ( ) const
inline

Returns face aspect for none culling mode.

◆ RenderFilter()

Standard_Integer OpenGl_Workspace::RenderFilter ( ) const
inline

Get rendering filter.

See also
ShouldRender()

◆ ResetAppliedAspect()

void OpenGl_Workspace::ResetAppliedAspect ( )

Clear the applied aspect state to default values.

◆ ResetSkippedCounter()

void OpenGl_Workspace::ResetSkippedCounter ( )
inline

Reset skipped transparent elements counter.

See also
OpenGl_LayerList::Render()

◆ SetAllowFaceCulling()

bool OpenGl_Workspace::SetAllowFaceCulling ( bool theToAllow)
inline

Allow or disallow face culling. This call does NOT affect current state of back face culling; ApplyAspectFace() should be called to update state.

◆ SetAspects()

const OpenGl_Aspects * OpenGl_Workspace::SetAspects ( const OpenGl_Aspects * theAspect)

Assign new aspects (will be applied within ApplyAspects()).

◆ SetDefaultPolygonOffset()

Graphic3d_PolygonOffset OpenGl_Workspace::SetDefaultPolygonOffset ( const Graphic3d_PolygonOffset & theOffset)

Configure default polygon offset parameters. Return previous settings.

◆ SetEnvironmentTexture()

void OpenGl_Workspace::SetEnvironmentTexture ( const Handle< OpenGl_TextureSet > & theTexture)
inline

Sets a new environment texture.

◆ SetHighlightStyle()

void OpenGl_Workspace::SetHighlightStyle ( const Handle< Graphic3d_PresentationAttributes > & theStyle)
inline

Set highlight style.

◆ SetRenderFilter()

void OpenGl_Workspace::SetRenderFilter ( Standard_Integer theFilter)
inline

Set filter for restricting rendering of particular elements.

See also
ShouldRender()

◆ SetUseZBuffer()

Standard_Boolean OpenGl_Workspace::SetUseZBuffer ( const Standard_Boolean theToUse)
inline

Setup Z-buffer usage flag (without affecting GL state!). Returns previously set flag.

◆ ShouldRender()

bool OpenGl_Workspace::ShouldRender ( const OpenGl_Element * theElement,
const OpenGl_Group * theGroup )

Checks whether the element can be rendered or not.

Parameters
theElement[in] the element to check
theGroup[in] the group containing the element
Returns
True if element can be rendered

◆ TextColor()

const OpenGl_Vec4 & OpenGl_Workspace::TextColor ( ) const
inline

Return text color taking into account highlight flag.

◆ TextSubtitleColor()

const OpenGl_Vec4 & OpenGl_Workspace::TextSubtitleColor ( ) const
inline

Return text Subtitle color taking into account highlight flag.

◆ TextureSet()

const Handle< OpenGl_TextureSet > & OpenGl_Workspace::TextureSet ( ) const
inline

Return TextureSet from set Aspects or Environment texture.

◆ ToAllowFaceCulling()

bool OpenGl_Workspace::ToAllowFaceCulling ( ) const
inline

Return true if active group might activate face culling (e.g. primitives are closed).

◆ ToHighlight()

bool OpenGl_Workspace::ToHighlight ( ) const
inline

Return true if following structures should apply highlight color.

◆ UseDepthWrite()

Standard_Boolean & OpenGl_Workspace::UseDepthWrite ( )
inline
Returns
true if depth writing is enabled.

◆ UseZBuffer()

Standard_Boolean & OpenGl_Workspace::UseZBuffer ( )
inline
Returns
true if usage of Z buffer is enabled.

◆ View()

OpenGl_View * OpenGl_Workspace::View ( ) const
inline

◆ Width()

Standard_Integer OpenGl_Workspace::Width ( ) const

Field Documentation

◆ myAspectFaceAppliedWithHL

Handle< Graphic3d_PresentationAttributes > OpenGl_Workspace::myAspectFaceAppliedWithHL
protected

counter of skipped transparent elements for OpenGl_LayerList two rendering passes method

◆ myAspectFaceHl

OpenGl_Aspects OpenGl_Workspace::myAspectFaceHl
protected

Hiddenline aspect.

◆ myAspectsApplied

Handle< Graphic3d_Aspects > OpenGl_Workspace::myAspectsApplied
protected

counter of skipped transparent elements for OpenGl_LayerList two rendering passes method

◆ myAspectsSet

const OpenGl_Aspects* OpenGl_Workspace::myAspectsSet
protected

counter of skipped transparent elements for OpenGl_LayerList two rendering passes method

◆ myDefaultAspects

OpenGl_Aspects OpenGl_Workspace::myDefaultAspects
protected

counter of skipped transparent elements for OpenGl_LayerList two rendering passes method

◆ myEnvironmentTexture

Handle< OpenGl_TextureSet > OpenGl_Workspace::myEnvironmentTexture
protected

counter of skipped transparent elements for OpenGl_LayerList two rendering passes method

◆ myFrontCulling

OpenGl_Aspects OpenGl_Workspace::myFrontCulling
protected

◆ myGlContext

Handle< OpenGl_Context > OpenGl_Workspace::myGlContext
protected

◆ myHighlightStyle

Handle< Graphic3d_PresentationAttributes > OpenGl_Workspace::myHighlightStyle
protected

active highlight style

◆ myNbSkippedTranspElems

Standard_Integer OpenGl_Workspace::myNbSkippedTranspElems
protected

counter of skipped transparent elements for OpenGl_LayerList two rendering passes method

◆ myNoneCulling

OpenGl_Aspects OpenGl_Workspace::myNoneCulling
protected

◆ myRenderFilter

Standard_Integer OpenGl_Workspace::myRenderFilter
protected

active filter for skipping rendering of elements by some criteria (multiple render passes)

◆ myToAllowFaceCulling

bool OpenGl_Workspace::myToAllowFaceCulling
protected

allow back face culling

◆ myUseDepthWrite

Standard_Boolean OpenGl_Workspace::myUseDepthWrite
protected

◆ myUseZBuffer

Standard_Boolean OpenGl_Workspace::myUseZBuffer
protected

◆ myView

OpenGl_View* OpenGl_Workspace::myView
protected

◆ myWindow

Handle< OpenGl_Window > OpenGl_Workspace::myWindow
protected

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