Open CASCADE Technology
6.9.0
|
Represents window with GL context. Provides methods to render primitives and maintain GL state. More...
#include <OpenGl_Workspace.hxx>
Public Member Functions | |
OpenGl_Workspace (const Handle< OpenGl_GraphicDriver > &theDriver, const CALL_DEF_WINDOW &theCWindow, Aspect_RenderingContext theGContext, const Handle< OpenGl_Caps > &theCaps, const Handle< OpenGl_Context > &theShareCtx) | |
Main constructor - prepare GL context for specified window. More... | |
virtual | ~OpenGl_Workspace () |
Destructor. More... | |
void | SetActiveView (const Handle< OpenGl_View > &theView, const Standard_Integer theViewId) |
const Handle< OpenGl_View > & | ActiveView () const |
Standard_Integer | ActiveViewId () const |
void | Redraw (const Graphic3d_CView &theCView, const Aspect_CLayer2d &theCUnderLayer, const Aspect_CLayer2d &theCOverLayer) |
Redraw the window. More... | |
Standard_Boolean | SetImmediateModeDrawToFront (const Standard_Boolean theDrawToFrontBuffer) |
void | RedrawImmediate (const Graphic3d_CView &theCView, const Aspect_CLayer2d &theCUnderLayer, const Aspect_CLayer2d &theCOverLayer) |
void | Invalidate (const Graphic3d_CView &) |
Standard_Boolean | Print (const Handle< OpenGl_PrinterContext > &thePrintContext, const Graphic3d_CView &theCView, const Aspect_CLayer2d &theCUnderLayer, const Aspect_CLayer2d &theCOverLayer, const Aspect_Handle theHPrintDC, const Standard_Boolean theToShowBackground, const Standard_CString theFileName, const Aspect_PrintAlgo thePrintAlgorithm, const Standard_Real theScaleFactor) |
Special method to perform printing. System-specific and currently only Win platform implemented. More... | |
const Handle < OpenGl_PrinterContext > & | PrinterContext () const |
void | DisplayCallback (const Graphic3d_CView &theCView, int theReason) |
Graphic3d_PtrFrameBuffer | FBOCreate (const Standard_Integer theWidth, const Standard_Integer theHeight) |
void | FBORelease (Graphic3d_PtrFrameBuffer theFBOPtr) |
Standard_Boolean | BufferDump (OpenGl_FrameBuffer *theFBOPtr, Image_PixMap &theImage, const Graphic3d_BufferType &theBufferType) |
Standard_Boolean & | UseZBuffer () |
Standard_Boolean & | UseDepthTest () |
Standard_Boolean & | UseGLLight () |
Standard_Integer | AntiAliasingMode () const |
const OpenGl_AspectLine * | SetAspectLine (const OpenGl_AspectLine *theAspect) |
const OpenGl_AspectFace * | SetAspectFace (const OpenGl_AspectFace *theAspect) |
const OpenGl_AspectMarker * | SetAspectMarker (const OpenGl_AspectMarker *theAspect) |
const OpenGl_AspectText * | SetAspectText (const OpenGl_AspectText *theAspect) |
void | SetTextParam (const OpenGl_TextParam *theParam) |
const OpenGl_AspectLine * | AspectLine (const Standard_Boolean theWithApply) |
const OpenGl_AspectFace * | AspectFace (const Standard_Boolean theWithApply) |
const OpenGl_AspectMarker * | AspectMarker (const Standard_Boolean theWithApply) |
const OpenGl_AspectText * | AspectText (const Standard_Boolean theWithApply) |
const OpenGl_TextParam * | AspectTextParams () const |
void | ResetAppliedAspect () |
Clear the applied aspect state. More... | |
Handle< OpenGl_Texture > | DisableTexture () |
Handle< OpenGl_Texture > | EnableTexture (const Handle< OpenGl_Texture > &theTexture, const Handle< Graphic3d_TextureParams > &theParams=NULL) |
const Handle< OpenGl_Texture > & | ActiveTexture () const |
void | SetRenderFilter (const Handle< OpenGl_RenderFilter > &theFilter) |
Set filter for restricting rendering of particular elements. Filter can be applied for rendering passes used by recursive rendering algorithms for rendering elements of groups. More... | |
const Handle < OpenGl_RenderFilter > & | GetRenderFilter () const |
Get rendering filter. More... | |
const OpenGl_Matrix * | ViewMatrix () const |
const OpenGl_Matrix * | ModelMatrix () const |
void | SetPolygonOffset (int theMode, Standard_ShortReal theFactor, Standard_ShortReal theUnits) |
Sets and applies current polygon offset. More... | |
const TEL_POFFSET_PARAM & | AppliedPolygonOffset () |
Returns currently applied polygon offset params. More... | |
Standard_Boolean | IsCullingEnabled () const |
Public Member Functions inherited from OpenGl_Window | |
OpenGl_Window (const Handle< OpenGl_GraphicDriver > &theDriver, const CALL_DEF_WINDOW &theCWindow, Aspect_RenderingContext theGContext, const Handle< OpenGl_Caps > &theCaps, const Handle< OpenGl_Context > &theShareCtx) | |
Main constructor - prepare GL context for specified window. More... | |
virtual | ~OpenGl_Window () |
Destructor. More... | |
void | Resize (const CALL_DEF_WINDOW &theCWindow) |
Resizes the window. More... | |
void | ReadDepths (const Standard_Integer theX, const Standard_Integer theY, const Standard_Integer theWidth, const Standard_Integer theHeight, float *theDepths) |
Reads depth component for current scene into specified buffer. More... | |
void | SetBackgroundColor (const Standard_ShortReal theR, const Standard_ShortReal theG, const Standard_ShortReal theB) |
Standard_Integer | Width () const |
Standard_Integer | Height () const |
const TEL_COLOUR & | BackgroundColor () const |
const Handle< OpenGl_Context > & | GetGlContext () const |
Public Member Functions inherited from MMgt_TShared | |
virtual void | Delete () const |
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_Transient & | operator= (const Standard_Transient &) |
Assignment operator, needed to avoid copying reference counter. More... | |
virtual | ~Standard_Transient () |
Destructor must be virtual. More... | |
virtual const Handle_Standard_Type & | DynamicType () const |
Returns a type information object about this object. More... | |
Standard_Boolean | IsInstance (const 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 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... | |
virtual Handle_Standard_Transient | This () const |
Returns a Handle which references this object. Must never be called to objects created in stack. More... | |
Standard_Integer | GetRefCount () const |
Get the reference counter of this object. More... | |
Data Fields | |
Standard_Integer | NamedStatus |
const TEL_COLOUR * | HighlightColor |
Protected Member Functions | |
void | copyBackToFront () |
Copy content of Back buffer to the Front buffer. More... | |
bool | blitBuffers (OpenGl_FrameBuffer *theReadFbo, OpenGl_FrameBuffer *theDrawFbo) |
Blit image from/to specified buffers. More... | |
virtual Standard_Boolean | Activate () |
Makes GL context for this window active in current thread. More... | |
void | redraw1 (const Graphic3d_CView &theCView, const Aspect_CLayer2d &theCUnderLayer, const Aspect_CLayer2d &theCOverLayer, OpenGl_FrameBuffer *theReadDrawFbo, const Graphic3d_Camera::Projection theProjection) |
void | bindDefaultFbo (OpenGl_FrameBuffer *theCustomFbo=NULL) |
Setup default FBO. More... | |
void | drawStereoPair () |
Blend together views pair into stereo image. More... | |
bool | redrawImmediate (const Graphic3d_CView &theCView, const Aspect_CLayer2d &theCUnderLayer, const Aspect_CLayer2d &theCOverLayer, OpenGl_FrameBuffer *theReadFbo, const Graphic3d_Camera::Projection theProjection, OpenGl_FrameBuffer *theDrawFbo, const Standard_Boolean theIsPartialUpdate=Standard_False) |
Blit snapshot containing main scene (myMainSceneFbos or BackBuffer) into presentation buffer (myMainSceneFbos -> offscreen FBO or myMainSceneFbos -> BackBuffer or BackBuffer -> FrontBuffer), and redraw immediate structures on top. More... | |
void | updateMaterial (const int theFlag) |
void | setTextureParams (Handle< OpenGl_Texture > &theTexture, const Handle< Graphic3d_TextureParams > &theParams) |
Protected Member Functions inherited from OpenGl_Window | |
void | Init () |
Activates GL context and setup viewport. More... | |
void | EnableFeatures () const |
void | DisableFeatures () const |
Protected Attributes | |
protected fields | |
Handle< OpenGl_FrameBuffer > | myMainSceneFbos [2] |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers). More... | |
Handle< OpenGl_FrameBuffer > | myImmediateSceneFbos [2] |
Additional buffers for immediate layer in stereo mode. More... | |
Standard_Boolean | myHasFboBlit |
Special flag which is invalidated when myMainSceneFbos can not be blitted for some reason (e.g. driver bugs). More... | |
OpenGl_VertexBuffer | myFullScreenQuad |
Vertices for full-screen quad rendering. More... | |
Handle< OpenGl_PrinterContext > | myPrintContext |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers). More... | |
Handle< OpenGl_View > | myView |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers). More... | |
Handle< OpenGl_LineAttributes > | myLineAttribs |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers). More... | |
Standard_Integer | myViewId |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers). More... | |
Standard_Integer | myAntiAliasingMode |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers). More... | |
Standard_Boolean | myTransientDrawToFront |
optimization flag for immediate mode (to render directly to the front buffer) More... | |
Standard_Boolean | myBackBufferRestored |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers). More... | |
Standard_Boolean | myIsImmediateDrawn |
flag indicates that immediate mode buffer contains some data More... | |
Standard_Boolean | myUseZBuffer |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers). More... | |
Standard_Boolean | myUseDepthTest |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers). More... | |
Standard_Boolean | myUseGLLight |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers). More... | |
Standard_Boolean | myIsCullingEnabled |
frustum culling flag More... | |
unsigned int | myFrameCounter |
redraw counter, for debugging More... | |
fields related to status | |
Handle< OpenGl_RenderFilter > | myRenderFilter |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) More... | |
Handle< OpenGl_Texture > | myTextureBound |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) More... | |
const OpenGl_AspectLine * | AspectLine_set |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) More... | |
const OpenGl_AspectLine * | AspectLine_applied |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) More... | |
const OpenGl_AspectFace * | AspectFace_set |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) More... | |
const OpenGl_AspectFace * | AspectFace_applied |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) More... | |
const OpenGl_AspectMarker * | AspectMarker_set |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) More... | |
const OpenGl_AspectMarker * | AspectMarker_applied |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) More... | |
const OpenGl_AspectText * | AspectText_set |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) More... | |
const OpenGl_AspectText * | AspectText_applied |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) More... | |
const OpenGl_TextParam * | TextParam_set |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) More... | |
const OpenGl_TextParam * | TextParam_applied |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) More... | |
const OpenGl_Matrix * | ViewMatrix_applied |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) More... | |
const OpenGl_Matrix * | StructureMatrix_applied |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture) More... | |
OpenGl_Material | myMatFront |
current front material state (cached to reduce GL context updates) More... | |
OpenGl_Material | myMatBack |
current back material state More... | |
OpenGl_Material | myMatTmp |
temporary variable More... | |
TelCullMode | myCullingMode |
back face culling mode, applied from face aspect More... | |
OpenGl_Matrix | myModelViewMatrix |
Model matrix with applied structure transformations. More... | |
TEL_POFFSET_PARAM | PolygonOffset_applied |
Currently applied polygon offset. More... | |
OpenGl_AspectFace | myAspectFaceHl |
Hiddenline aspect. More... | |
Protected Attributes inherited from OpenGl_Window | |
Handle< OpenGl_Context > | myGlContext |
Standard_Boolean | myOwnGContext |
set to TRUE if GL context was not created by this class More... | |
Standard_Integer | myWidth |
window width in pixels More... | |
Standard_Integer | myHeight |
window height in pixels More... | |
TEL_COLOUR | myBgColor |
background color More... | |
Represents window with GL context. Provides methods to render primitives and maintain GL state.
OpenGl_Workspace::OpenGl_Workspace | ( | const Handle< OpenGl_GraphicDriver > & | theDriver, |
const CALL_DEF_WINDOW & | theCWindow, | ||
Aspect_RenderingContext | theGContext, | ||
const Handle< OpenGl_Caps > & | theCaps, | ||
const Handle< OpenGl_Context > & | theShareCtx | ||
) |
Main constructor - prepare GL context for specified window.
|
virtual |
Destructor.
|
protectedvirtual |
Makes GL context for this window active in current thread.
Reimplemented from OpenGl_Window.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns currently applied polygon offset params.
const OpenGl_AspectFace* OpenGl_Workspace::AspectFace | ( | const Standard_Boolean | theWithApply | ) |
const OpenGl_AspectLine* OpenGl_Workspace::AspectLine | ( | const Standard_Boolean | theWithApply | ) |
const OpenGl_AspectMarker* OpenGl_Workspace::AspectMarker | ( | const Standard_Boolean | theWithApply | ) |
const OpenGl_AspectText* OpenGl_Workspace::AspectText | ( | const Standard_Boolean | theWithApply | ) |
|
inline |
|
protected |
Setup default FBO.
|
protected |
Blit image from/to specified buffers.
Standard_Boolean OpenGl_Workspace::BufferDump | ( | OpenGl_FrameBuffer * | theFBOPtr, |
Image_PixMap & | theImage, | ||
const Graphic3d_BufferType & | theBufferType | ||
) |
|
protected |
Copy content of Back buffer to the Front buffer.
Handle< OpenGl_Texture > OpenGl_Workspace::DisableTexture | ( | ) |
void OpenGl_Workspace::DisplayCallback | ( | const Graphic3d_CView & | theCView, |
int | theReason | ||
) |
|
protected |
Blend together views pair into stereo image.
Handle< OpenGl_Texture > OpenGl_Workspace::EnableTexture | ( | const Handle< OpenGl_Texture > & | theTexture, |
const Handle< Graphic3d_TextureParams > & | theParams = NULL |
||
) |
Graphic3d_PtrFrameBuffer OpenGl_Workspace::FBOCreate | ( | const Standard_Integer | theWidth, |
const Standard_Integer | theHeight | ||
) |
void OpenGl_Workspace::FBORelease | ( | Graphic3d_PtrFrameBuffer | theFBOPtr | ) |
|
inline |
Get rendering filter.
|
inline |
|
inline |
|
inline |
Standard_Boolean OpenGl_Workspace::Print | ( | const Handle< OpenGl_PrinterContext > & | thePrintContext, |
const Graphic3d_CView & | theCView, | ||
const Aspect_CLayer2d & | theCUnderLayer, | ||
const Aspect_CLayer2d & | theCOverLayer, | ||
const Aspect_Handle | theHPrintDC, | ||
const Standard_Boolean | theToShowBackground, | ||
const Standard_CString | theFileName, | ||
const Aspect_PrintAlgo | thePrintAlgorithm, | ||
const Standard_Real | theScaleFactor | ||
) |
Special method to perform printing. System-specific and currently only Win platform implemented.
|
inline |
void OpenGl_Workspace::Redraw | ( | const Graphic3d_CView & | theCView, |
const Aspect_CLayer2d & | theCUnderLayer, | ||
const Aspect_CLayer2d & | theCOverLayer | ||
) |
Redraw the window.
|
protected |
void OpenGl_Workspace::RedrawImmediate | ( | const Graphic3d_CView & | theCView, |
const Aspect_CLayer2d & | theCUnderLayer, | ||
const Aspect_CLayer2d & | theCOverLayer | ||
) |
|
protected |
Blit snapshot containing main scene (myMainSceneFbos or BackBuffer) into presentation buffer (myMainSceneFbos -> offscreen FBO or myMainSceneFbos -> BackBuffer or BackBuffer -> FrontBuffer), and redraw immediate structures on top.
When scene caching is disabled (myTransientDrawToFront, no double buffer in window, etc.), the first step (blitting) will be skipped.
void OpenGl_Workspace::ResetAppliedAspect | ( | ) |
Clear the applied aspect state.
|
inline |
const OpenGl_AspectFace* OpenGl_Workspace::SetAspectFace | ( | const OpenGl_AspectFace * | theAspect | ) |
const OpenGl_AspectLine* OpenGl_Workspace::SetAspectLine | ( | const OpenGl_AspectLine * | theAspect | ) |
const OpenGl_AspectMarker* OpenGl_Workspace::SetAspectMarker | ( | const OpenGl_AspectMarker * | theAspect | ) |
const OpenGl_AspectText* OpenGl_Workspace::SetAspectText | ( | const OpenGl_AspectText * | theAspect | ) |
Standard_Boolean OpenGl_Workspace::SetImmediateModeDrawToFront | ( | const Standard_Boolean | theDrawToFrontBuffer | ) |
void OpenGl_Workspace::SetPolygonOffset | ( | int | theMode, |
Standard_ShortReal | theFactor, | ||
Standard_ShortReal | theUnits | ||
) |
Sets and applies current polygon offset.
|
inline |
Set filter for restricting rendering of particular elements. Filter can be applied for rendering passes used by recursive rendering algorithms for rendering elements of groups.
theFilter | [in] the filter instance. |
|
inline |
|
protected |
|
protected |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
|
protected |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
|
protected |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
|
protected |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
|
protected |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
|
protected |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
|
protected |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
|
protected |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
const TEL_COLOUR* OpenGl_Workspace::HighlightColor |
|
protected |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers).
|
protected |
Hiddenline aspect.
|
protected |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers).
|
protected |
back face culling mode, applied from face aspect
|
protected |
redraw counter, for debugging
|
protected |
Vertices for full-screen quad rendering.
|
protected |
Special flag which is invalidated when myMainSceneFbos can not be blitted for some reason (e.g. driver bugs).
|
protected |
Additional buffers for immediate layer in stereo mode.
|
protected |
frustum culling flag
|
protected |
flag indicates that immediate mode buffer contains some data
|
protected |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers).
|
protected |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers).
|
protected |
current back material state
|
protected |
current front material state (cached to reduce GL context updates)
|
protected |
temporary variable
|
protected |
Model matrix with applied structure transformations.
|
protected |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers).
|
protected |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
|
protected |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
|
protected |
optimization flag for immediate mode (to render directly to the front buffer)
|
protected |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers).
|
protected |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers).
|
protected |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers).
|
protected |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers).
|
protected |
Two framebuffers (left and right views) store cached main presentation of the view (without presentation of immediate layers).
Standard_Integer OpenGl_Workspace::NamedStatus |
|
protected |
Currently applied polygon offset.
|
protected |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
|
protected |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
|
protected |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
|
protected |
currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)