Open CASCADE Technology  7.0.0
Public Member Functions | Data Fields | Protected Attributes
OpenGl_GraphicDriver Class Reference

This class defines an OpenGl graphic driver. More...

#include <OpenGl_GraphicDriver.hxx>

Inheritance diagram for OpenGl_GraphicDriver:
Inheritance graph
[legend]

Public Member Functions

 OpenGl_GraphicDriver (const Handle< Aspect_DisplayConnection > &theDisp, const Standard_Boolean theToInitialize=Standard_True)
 Constructor. More...
 
virtual ~OpenGl_GraphicDriver ()
 Destructor. More...
 
void ReleaseContext ()
 Release default context. More...
 
Standard_Boolean InitContext ()
 Perform initialization of default OpenGL context. More...
 
Standard_Integer InquireLightLimit () override
 call_togl_inquirelight More...
 
Standard_Integer InquireViewLimit () override
 call_togl_inquireview More...
 
virtual Handle< Graphic3d_CStructureCreateStructure (const Handle< Graphic3d_StructureManager > &theManager) override
 Creates new empty graphic structure. More...
 
virtual void RemoveStructure (Handle< Graphic3d_CStructure > &theCStructure) override
 Removes structure from graphic driver and releases its resources. More...
 
virtual Handle< Graphic3d_CViewCreateView (const Handle< Graphic3d_StructureManager > &theMgr) override
 Creates new view for this graphic driver. More...
 
virtual void RemoveView (const Handle< Graphic3d_CView > &theView) override
 Removes view from graphic driver and releases its resources. More...
 
virtual Handle< OpenGl_WindowCreateRenderWindow (const Handle< Aspect_Window > &theWindow, const Aspect_RenderingContext theContext)
 
void TextSize (const Handle< Graphic3d_CView > &theView, const Standard_CString theText, const Standard_ShortReal theHeight, Standard_ShortReal &theWidth, Standard_ShortReal &theAscent, Standard_ShortReal &theDescent) const override
 Computes text width. More...
 
Standard_Integer InquirePlaneLimit () override
 call_togl_inquireplane More...
 
Standard_ShortReal DefaultTextHeight () const override
 
Standard_Boolean ViewExists (const Handle< Aspect_Window > &theWindow, Handle< Graphic3d_CView > &theView) override
 Returns view associated with the window if it is exists and is activated. Returns Standard_True if the view associated to the window exists. More...
 
void AddZLayer (const Graphic3d_ZLayerId theLayerId) override
 Adds a new top-level z layer with ID theLayerId for all views. Z layers allow drawing structures in higher layers in foreground of structures in lower layers. To add a structure to desired layer on display it is necessary to set the layer index for the structure. The passed theLayerId should be not less than 0 (reserved for default layers). More...
 
void RemoveZLayer (const Graphic3d_ZLayerId theLayerId) override
 Removes Z layer. All structures displayed at the moment in layer will be displayed in default layer (the bottom-level z layer). By default, there are always default bottom-level layer that can't be removed. The passed theLayerId should be not less than 0 (reserved for default layers that can not be removed). More...
 
void ZLayers (TColStd_SequenceOfInteger &theLayerSeq) const override
 Returns list of Z layers defined for the graphical driver. More...
 
void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId, const Graphic3d_ZLayerSettings &theSettings) override
 Sets the settings for a single Z layer. More...
 
virtual Graphic3d_ZLayerSettings ZLayerSettings (const Graphic3d_ZLayerId theLayerId) override
 Returns the settings of a single Z layer. More...
 
const OpenGl_CapsOptions () const
 
OpenGl_CapsChangeOptions ()
 
void SetBuffersNoSwap (const Standard_Boolean theIsNoSwap)
 Specify swap buffer behavior. More...
 
void EnableVBO (const Standard_Boolean theToTurnOn) override
 VBO usage can be forbidden by this method even if it is supported by GL driver. Notice that disabling of VBO will cause rendering performance degradation. Warning! This method should be called only before any primitives are displayed in GL scene! More...
 
Standard_Boolean MemoryInfo (Standard_Size &theFreeBytes, TCollection_AsciiString &theInfo) const override
 Returns information about GPU memory usage. Please read OpenGl_Context::MemoryInfo() for more description. More...
 
const Handle< OpenGl_Context > & GetSharedContext () const
 Method to retrieve valid GL context. Could return NULL-handle if no window created by this driver. More...
 
OpenGl_StateCounterGetStateCounter () const
 State counter for OpenGl structures. More...
 
Standard_Size GetNextPrimitiveArrayUID () const
 Returns unique ID for primitive arrays. More...
 
- Public Member Functions inherited from Graphic3d_GraphicDriver
const Handle< Aspect_DisplayConnection > & GetDisplayConnection () const
 returns Handle to display connection More...
 
Standard_Boolean IsDeviceLost () const
 
void ResetDeviceLostFlag ()
 
- Public Member Functions inherited from MMgt_TShared
virtual void Delete () const override
 Memory deallocator for transient classes. More...
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object. More...
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
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. More...
 
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. More...
 
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. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 
void IncrementRefCounter () const
 Increments the reference counter of this object. More...
 
Standard_Integer DecrementRefCounter () const
 Decrements the reference counter of this object; returns the decremented value. More...
 

Data Fields

TColStd_MapOfInteger myLayerIds
 
TColStd_SequenceOfInteger myLayerSeq
 
OpenGl_MapOfZLayerSettings myMapOfZLayerSettings
 

Protected Attributes

Standard_Boolean myIsOwnContext
 indicates that shared context has been created within OpenGl_GraphicDriver More...
 
Handle< OpenGl_CapsmyCaps
 
NCollection_Map< Handle< OpenGl_View > > myMapOfView
 
NCollection_DataMap< Standard_Integer, OpenGl_Structure * > myMapOfStructure
 
OpenGl_StateCounter myStateCounter
 State counter for OpenGl structures. More...
 
OpenGl_StateCounter myUIDGenerator
 Unique ID counter for primitive arrays. More...
 
- Protected Attributes inherited from Graphic3d_GraphicDriver
Handle< Aspect_DisplayConnectionmyDisplayConnection
 
Standard_Boolean myDeviceLostFlag
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object. More...
 
- Static Public Member Functions inherited from Standard_Transient
static const char * get_type_name ()
 Returns a type descriptor about this object. More...
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class. More...
 
- Protected Member Functions inherited from Graphic3d_GraphicDriver
 Graphic3d_GraphicDriver (const Handle< Aspect_DisplayConnection > &theDisp)
 Initializes the Driver. More...
 

Detailed Description

This class defines an OpenGl graphic driver.

Constructor & Destructor Documentation

OpenGl_GraphicDriver::OpenGl_GraphicDriver ( const Handle< Aspect_DisplayConnection > &  theDisp,
const Standard_Boolean  theToInitialize = Standard_True 
)

Constructor.

Parameters
theDispconnection to display, required on Linux but optional on other systems
theToInitializeperform initialization of default OpenGL context on construction
virtual OpenGl_GraphicDriver::~OpenGl_GraphicDriver ( )
virtual

Destructor.

Member Function Documentation

void OpenGl_GraphicDriver::AddZLayer ( const Graphic3d_ZLayerId  theLayerId)
overridevirtual

Adds a new top-level z layer with ID theLayerId for all views. Z layers allow drawing structures in higher layers in foreground of structures in lower layers. To add a structure to desired layer on display it is necessary to set the layer index for the structure. The passed theLayerId should be not less than 0 (reserved for default layers).

Implements Graphic3d_GraphicDriver.

OpenGl_Caps& OpenGl_GraphicDriver::ChangeOptions ( )
inline
Returns
the visualization options
virtual Handle< OpenGl_Window > OpenGl_GraphicDriver::CreateRenderWindow ( const Handle< Aspect_Window > &  theWindow,
const Aspect_RenderingContext  theContext 
)
virtual
virtual Handle< Graphic3d_CStructure > OpenGl_GraphicDriver::CreateStructure ( const Handle< Graphic3d_StructureManager > &  theManager)
overridevirtual

Creates new empty graphic structure.

Implements Graphic3d_GraphicDriver.

virtual Handle< Graphic3d_CView > OpenGl_GraphicDriver::CreateView ( const Handle< Graphic3d_StructureManager > &  theMgr)
overridevirtual

Creates new view for this graphic driver.

Implements Graphic3d_GraphicDriver.

Reimplemented in D3DHost_GraphicDriver.

Standard_ShortReal OpenGl_GraphicDriver::DefaultTextHeight ( ) const
overridevirtual
void OpenGl_GraphicDriver::EnableVBO ( const Standard_Boolean  theToTurnOn)
overridevirtual

VBO usage can be forbidden by this method even if it is supported by GL driver. Notice that disabling of VBO will cause rendering performance degradation. Warning! This method should be called only before any primitives are displayed in GL scene!

Implements Graphic3d_GraphicDriver.

Standard_Size OpenGl_GraphicDriver::GetNextPrimitiveArrayUID ( ) const
inline

Returns unique ID for primitive arrays.

const Handle< OpenGl_Context >& OpenGl_GraphicDriver::GetSharedContext ( ) const

Method to retrieve valid GL context. Could return NULL-handle if no window created by this driver.

OpenGl_StateCounter* OpenGl_GraphicDriver::GetStateCounter ( ) const
inline

State counter for OpenGl structures.

Standard_Boolean OpenGl_GraphicDriver::InitContext ( )

Perform initialization of default OpenGL context.

Standard_Integer OpenGl_GraphicDriver::InquireLightLimit ( )
overridevirtual

call_togl_inquirelight

Implements Graphic3d_GraphicDriver.

Standard_Integer OpenGl_GraphicDriver::InquirePlaneLimit ( )
overridevirtual

call_togl_inquireplane

Implements Graphic3d_GraphicDriver.

Standard_Integer OpenGl_GraphicDriver::InquireViewLimit ( )
overridevirtual

call_togl_inquireview

Implements Graphic3d_GraphicDriver.

Standard_Boolean OpenGl_GraphicDriver::MemoryInfo ( Standard_Size theFreeBytes,
TCollection_AsciiString theInfo 
) const
overridevirtual

Returns information about GPU memory usage. Please read OpenGl_Context::MemoryInfo() for more description.

Implements Graphic3d_GraphicDriver.

const OpenGl_Caps& OpenGl_GraphicDriver::Options ( ) const
inline
Returns
the visualization options
void OpenGl_GraphicDriver::ReleaseContext ( )

Release default context.

virtual void OpenGl_GraphicDriver::RemoveStructure ( Handle< Graphic3d_CStructure > &  theCStructure)
overridevirtual

Removes structure from graphic driver and releases its resources.

Implements Graphic3d_GraphicDriver.

virtual void OpenGl_GraphicDriver::RemoveView ( const Handle< Graphic3d_CView > &  theView)
overridevirtual

Removes view from graphic driver and releases its resources.

Implements Graphic3d_GraphicDriver.

void OpenGl_GraphicDriver::RemoveZLayer ( const Graphic3d_ZLayerId  theLayerId)
overridevirtual

Removes Z layer. All structures displayed at the moment in layer will be displayed in default layer (the bottom-level z layer). By default, there are always default bottom-level layer that can't be removed. The passed theLayerId should be not less than 0 (reserved for default layers that can not be removed).

Implements Graphic3d_GraphicDriver.

void OpenGl_GraphicDriver::SetBuffersNoSwap ( const Standard_Boolean  theIsNoSwap)

Specify swap buffer behavior.

void OpenGl_GraphicDriver::SetZLayerSettings ( const Graphic3d_ZLayerId  theLayerId,
const Graphic3d_ZLayerSettings theSettings 
)
overridevirtual

Sets the settings for a single Z layer.

Implements Graphic3d_GraphicDriver.

void OpenGl_GraphicDriver::TextSize ( const Handle< Graphic3d_CView > &  theView,
const Standard_CString  theText,
const Standard_ShortReal  theHeight,
Standard_ShortReal theWidth,
Standard_ShortReal theAscent,
Standard_ShortReal theDescent 
) const
overridevirtual

Computes text width.

Implements Graphic3d_GraphicDriver.

Standard_Boolean OpenGl_GraphicDriver::ViewExists ( const Handle< Aspect_Window > &  theWindow,
Handle< Graphic3d_CView > &  theView 
)
overridevirtual

Returns view associated with the window if it is exists and is activated. Returns Standard_True if the view associated to the window exists.

Implements Graphic3d_GraphicDriver.

void OpenGl_GraphicDriver::ZLayers ( TColStd_SequenceOfInteger theLayerSeq) const
overridevirtual

Returns list of Z layers defined for the graphical driver.

Implements Graphic3d_GraphicDriver.

virtual Graphic3d_ZLayerSettings OpenGl_GraphicDriver::ZLayerSettings ( const Graphic3d_ZLayerId  theLayerId)
overridevirtual

Returns the settings of a single Z layer.

Implements Graphic3d_GraphicDriver.

Field Documentation

Handle< OpenGl_Caps > OpenGl_GraphicDriver::myCaps
protected
Standard_Boolean OpenGl_GraphicDriver::myIsOwnContext
protected

indicates that shared context has been created within OpenGl_GraphicDriver

TColStd_MapOfInteger OpenGl_GraphicDriver::myLayerIds
TColStd_SequenceOfInteger OpenGl_GraphicDriver::myLayerSeq
NCollection_DataMap<Standard_Integer, OpenGl_Structure*> OpenGl_GraphicDriver::myMapOfStructure
protected
NCollection_Map<Handle< OpenGl_View > > OpenGl_GraphicDriver::myMapOfView
protected
OpenGl_MapOfZLayerSettings OpenGl_GraphicDriver::myMapOfZLayerSettings
OpenGl_StateCounter OpenGl_GraphicDriver::myStateCounter
mutableprotected

State counter for OpenGl structures.

OpenGl_StateCounter OpenGl_GraphicDriver::myUIDGenerator
mutableprotected

Unique ID counter for primitive arrays.


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