Logo ROOT  
Reference Guide
TGLViewerBase Class Reference

Base class for GL viewers.

Provides a basic scene management and a small set of control variables (camera, LOD, style, clip) that are used by the scene classes. Renering wrappers are available but minimal.

There is no concept of GL-context here ... we just draw into whatever is set from outside.

Development notes:

Each viewer automatically creates a TGLRnrCtx and passes it down all render functions.

Definition at line 36 of file TGLViewerBase.h.

Public Member Functions

 TGLViewerBase ()
 
virtual ~TGLViewerBase ()
 Destructor. More...
 
virtual void AddOverlayElement (TGLOverlayElement *el)
 Add overlay element. More...
 
TGLSceneInfoAddScene (TGLSceneBase *scene)
 Add new scene, appropriate scene-info is created. More...
 
virtual void Changed ()
 
TGLClipClip () const
 
virtual void DeleteOverlayAnnotations ()
 Delete overlay elements that are annotations. More...
 
virtual void DeleteOverlayElements (TGLOverlayElement::ERole r)
 Delete overlay elements. More...
 
Bool_t FindClosestOpaqueRecord (TGLSelectRecord &rec, Int_t &recIdx)
 Find next select record that can be resolved and whose result is not transparent, starting from position 'recIdx'. More...
 
Bool_t FindClosestOverlayRecord (TGLOvlSelectRecord &rec, Int_t &recIdx)
 Find next overlay-select record that can be resolved, starting from position 'recIdx'. More...
 
Bool_t FindClosestRecord (TGLSelectRecord &rec, Int_t &recIdx)
 Find next select record that can be resolved, starting from position 'recIdx'. More...
 
TGLLogicalShapeFindLogicalInScenes (TObject *id)
 Find logical-shape representing object id in the list of scenes. More...
 
TGLRnrCtxGetRnrCtx () const
 
TGLSceneInfoGetSceneInfo (TGLSceneBase *scene)
 Find scene-info corresponding to scene. More...
 
virtual Bool_t IsChanged () const
 
virtual const char * LockIdStr () const
 Name to print in locking output. More...
 
Short_t LOD () const
 
virtual void MergeSceneBBoxes (TGLBoundingBox &bbox)
 Merge bounding-boxes of all active registered scenes. More...
 
Float_t OLLineW () const
 
virtual void PostRender ()
 Function called after rendering is finished. More...
 
virtual void PostRenderOverlaySelection ()
 Perform cleanup after overlay selection. More...
 
virtual void PreRender ()
 Initialize render-context, setup camera, GL, render-area. More...
 
virtual void PreRenderOverlaySelection ()
 Perform minimal initialization for overlay selection. More...
 
const TGLBoundingBoxRefOverallBoundingBox () const
 
void RemoveAllScenes ()
 Remove all scenes from the viewer, their scene-infos are deleted. More...
 
virtual void RemoveOverlayElement (TGLOverlayElement *el)
 Remove overlay element. More...
 
void RemoveScene (TGLSceneBase *scene)
 Remove scene from the viewer, its scene-info is deleted. More...
 
virtual void Render ()
 Render all scenes. More...
 
virtual void RenderNonSelected ()
 Render non-selected objects from all scenes. More...
 
virtual void RenderOpaque (Bool_t rnr_non_selected=kTRUE, Bool_t rnr_selected=kTRUE)
 Render opaque objects from all scenes. More...
 
virtual void RenderOverlay (Int_t state, Bool_t selection)
 Render overlay objects. More...
 
virtual void RenderSelected ()
 Render selected objects from all scenes. More...
 
virtual void RenderSelectedForHighlight ()
 Render selected objects from all scenes for highlight. More...
 
virtual void RenderTransparent (Bool_t rnr_non_selected=kTRUE, Bool_t rnr_selected=kTRUE)
 Render transparent objects from all scenes. More...
 
virtual void ResetSceneInfos ()
 Force rebuild of view-dependent scene-info structures. More...
 
Bool_t ResolveSelectRecord (TGLSelectRecord &rec, Int_t recIdx)
 Process selection record on buffer-position 'recIdx' and fill the data into 'rec'. More...
 
TGLRnrCtxRnrCtx () const
 
void SceneDestructing (TGLSceneBase *scene)
 Remove scene, its scene-info is deleted. More...
 
void SetClip (TGLClip *p)
 
void SetLOD (Short_t lod)
 
void SetOLLineW (Float_t w)
 
void SetStyle (Short_t st)
 
void SetWFLineW (Float_t w)
 
Short_t Style () const
 
Float_t WFLineW () const
 
- Public Member Functions inherited from TGLLockable
 TGLLockable ()
 
virtual ~TGLLockable ()
 
ELock CurrentLock () const
 
Bool_t IsDrawOrSelectLock () const
 
Bool_t IsLocked () const
 
virtual const char * LockIdStr () const
 
Bool_t ReleaseLock (ELock lock) const
 Release current lock, make sure it the same as the 'lock' argument. More...
 
Bool_t TakeLock (ELock lock) const
 Lock the object in mode 'lock'. More...
 

Protected Types

typedef OverlayElmVec_t::iterator OverlayElmVec_i
 
typedef std::vector< TGLOverlayElement * > OverlayElmVec_t
 
typedef SceneInfoList_t::iterator SceneInfoList_i
 
typedef std::list< TGLSceneInfo * > SceneInfoList_t
 
typedef SceneInfoVec_t::iterator SceneInfoVec_i
 
typedef std::vector< TGLSceneInfo * > SceneInfoVec_t
 
typedef void(TGLSceneBase::* SubRender_foo) (TGLRnrCtx &)
 

Protected Member Functions

SceneInfoList_i FindScene (TGLSceneBase *scene)
 Find scene-info corresponding to scene. More...
 
virtual void SetupClipObject ()
 Setup clip-object. Protected virtual method. More...
 
void SubRenderScenes (SubRender_foo render_foo)
 Call sub-rendering function render_foo on all currently visible scenes. More...
 

Protected Attributes

TGLCamerafCamera
 
Bool_t fChanged
 
TGLClipfClip
 
Short_t fLOD
 
Float_t fOLLineW
 
TGLBoundingBox fOverallBoundingBox
 
OverlayElmVec_t fOverlay
 
Bool_t fResetSceneInfosOnRender
 
TGLRnrCtxfRnrCtx
 
SceneInfoList_t fScenes
 
Short_t fStyle
 
SceneInfoVec_t fVisScenes
 
Float_t fWFLineW
 
- Protected Attributes inherited from TGLLockable
ELock fLock
 

Private Member Functions

 TGLViewerBase (const TGLViewerBase &)
 
TGLViewerBaseoperator= (const TGLViewerBase &)
 

Additional Inherited Members

- Public Types inherited from TGLLockable
enum  ELock { kUnlocked , kDrawLock , kSelectLock , kModifyLock }
 
- Static Public Member Functions inherited from TGLLockable
static const char * LockName (ELock lock)
 Return name-string for given lock-type. More...
 
static Bool_t LockValid (ELock lock)
 Test if lock is a valid type to take/release. More...
 

#include <TGLViewerBase.h>

Inheritance diagram for TGLViewerBase:
[legend]

Member Typedef Documentation

◆ OverlayElmVec_i

typedef OverlayElmVec_t::iterator TGLViewerBase::OverlayElmVec_i
protected

Definition at line 50 of file TGLViewerBase.h.

◆ OverlayElmVec_t

typedef std::vector<TGLOverlayElement*> TGLViewerBase::OverlayElmVec_t
protected

Definition at line 49 of file TGLViewerBase.h.

◆ SceneInfoList_i

typedef SceneInfoList_t::iterator TGLViewerBase::SceneInfoList_i
protected

Definition at line 44 of file TGLViewerBase.h.

◆ SceneInfoList_t

typedef std::list<TGLSceneInfo*> TGLViewerBase::SceneInfoList_t
protected

Definition at line 43 of file TGLViewerBase.h.

◆ SceneInfoVec_i

typedef SceneInfoVec_t::iterator TGLViewerBase::SceneInfoVec_i
protected

Definition at line 47 of file TGLViewerBase.h.

◆ SceneInfoVec_t

typedef std::vector<TGLSceneInfo*> TGLViewerBase::SceneInfoVec_t
protected

Definition at line 46 of file TGLViewerBase.h.

◆ SubRender_foo

typedef void(TGLSceneBase::* TGLViewerBase::SubRender_foo) (TGLRnrCtx &)
protected

Definition at line 54 of file TGLViewerBase.h.

Constructor & Destructor Documentation

◆ TGLViewerBase() [1/2]

TGLViewerBase::TGLViewerBase ( const TGLViewerBase )
private

◆ TGLViewerBase() [2/2]

TGLViewerBase::TGLViewerBase ( )

Definition at line 54 of file TGLViewerBase.cxx.

◆ ~TGLViewerBase()

TGLViewerBase::~TGLViewerBase ( )
virtual

Destructor.

Definition at line 77 of file TGLViewerBase.cxx.

Member Function Documentation

◆ AddOverlayElement()

void TGLViewerBase::AddOverlayElement ( TGLOverlayElement el)
virtual

Add overlay element.

Definition at line 211 of file TGLViewerBase.cxx.

◆ AddScene()

TGLSceneInfo * TGLViewerBase::AddScene ( TGLSceneBase scene)

Add new scene, appropriate scene-info is created.

Definition at line 116 of file TGLViewerBase.cxx.

◆ Changed()

virtual void TGLViewerBase::Changed ( )
inlinevirtual

Definition at line 121 of file TGLViewerBase.h.

◆ Clip()

TGLClip * TGLViewerBase::Clip ( ) const
inline

Definition at line 104 of file TGLViewerBase.h.

◆ DeleteOverlayAnnotations()

void TGLViewerBase::DeleteOverlayAnnotations ( )
virtual

Delete overlay elements that are annotations.

Definition at line 231 of file TGLViewerBase.cxx.

◆ DeleteOverlayElements()

void TGLViewerBase::DeleteOverlayElements ( TGLOverlayElement::ERole  r)
virtual

Delete overlay elements.

Definition at line 239 of file TGLViewerBase.cxx.

◆ FindClosestOpaqueRecord()

Bool_t TGLViewerBase::FindClosestOpaqueRecord ( TGLSelectRecord rec,
Int_t recIdx 
)

Find next select record that can be resolved and whose result is not transparent, starting from position 'recIdx'.

'recIdx' is passed as reference and points to found record in the buffer.

Definition at line 642 of file TGLViewerBase.cxx.

◆ FindClosestOverlayRecord()

Bool_t TGLViewerBase::FindClosestOverlayRecord ( TGLOvlSelectRecord rec,
Int_t recIdx 
)

Find next overlay-select record that can be resolved, starting from position 'recIdx'.

'recIdx' is passed as reference and points to found record in the buffer.

Definition at line 660 of file TGLViewerBase.cxx.

◆ FindClosestRecord()

Bool_t TGLViewerBase::FindClosestRecord ( TGLSelectRecord rec,
Int_t recIdx 
)

Find next select record that can be resolved, starting from position 'recIdx'.

'recIdx' is passed as reference and points to found record in the buffer.

Definition at line 624 of file TGLViewerBase.cxx.

◆ FindLogicalInScenes()

TGLLogicalShape * TGLViewerBase::FindLogicalInScenes ( TObject id)

Find logical-shape representing object id in the list of scenes.

Return 0 if not found.

Definition at line 197 of file TGLViewerBase.cxx.

◆ FindScene()

TGLViewerBase::SceneInfoList_i TGLViewerBase::FindScene ( TGLSceneBase scene)
protected

Find scene-info corresponding to scene.

Definition at line 106 of file TGLViewerBase.cxx.

◆ GetRnrCtx()

TGLRnrCtx * TGLViewerBase::GetRnrCtx ( ) const
inline

Definition at line 158 of file TGLViewerBase.h.

◆ GetSceneInfo()

TGLSceneInfo * TGLViewerBase::GetSceneInfo ( TGLSceneBase scene)

Find scene-info corresponding to scene.

Definition at line 184 of file TGLViewerBase.cxx.

◆ IsChanged()

virtual Bool_t TGLViewerBase::IsChanged ( ) const
inlinevirtual

Definition at line 122 of file TGLViewerBase.h.

◆ LockIdStr()

const char * TGLViewerBase::LockIdStr ( ) const
virtual

Name to print in locking output.

Reimplemented from TGLLockable.

Definition at line 93 of file TGLViewerBase.cxx.

◆ LOD()

Short_t TGLViewerBase::LOD ( ) const
inline

Definition at line 107 of file TGLViewerBase.h.

◆ MergeSceneBBoxes()

void TGLViewerBase::MergeSceneBBoxes ( TGLBoundingBox bbox)
virtual

Merge bounding-boxes of all active registered scenes.

Definition at line 278 of file TGLViewerBase.cxx.

◆ OLLineW()

Float_t TGLViewerBase::OLLineW ( ) const
inline

Definition at line 115 of file TGLViewerBase.h.

◆ operator=()

TGLViewerBase & TGLViewerBase::operator= ( const TGLViewerBase )
private

◆ PostRender()

void TGLViewerBase::PostRender ( )
virtual

Function called after rendering is finished.

Here we just unlock the scenes.

Reimplemented in TGLViewer.

Definition at line 547 of file TGLViewerBase.cxx.

◆ PostRenderOverlaySelection()

void TGLViewerBase::PostRenderOverlaySelection ( )
virtual

Perform cleanup after overlay selection.

Definition at line 574 of file TGLViewerBase.cxx.

◆ PreRender()

void TGLViewerBase::PreRender ( )
virtual

Initialize render-context, setup camera, GL, render-area.

Check and lock scenes, determine their visibility.

Reimplemented in TGLViewer.

Definition at line 311 of file TGLViewerBase.cxx.

◆ PreRenderOverlaySelection()

void TGLViewerBase::PreRenderOverlaySelection ( )
virtual

Perform minimal initialization for overlay selection.

Here we assume that scene has already been drawn and that camera and overall bounding box are ok. Scenes are not locked.

Definition at line 566 of file TGLViewerBase.cxx.

◆ RefOverallBoundingBox()

const TGLBoundingBox & TGLViewerBase::RefOverallBoundingBox ( ) const
inline

Definition at line 126 of file TGLViewerBase.h.

◆ RemoveAllScenes()

void TGLViewerBase::RemoveAllScenes ( )

Remove all scenes from the viewer, their scene-infos are deleted.

Definition at line 152 of file TGLViewerBase.cxx.

◆ RemoveOverlayElement()

void TGLViewerBase::RemoveOverlayElement ( TGLOverlayElement el)
virtual

Remove overlay element.

Reimplemented in TGLViewer.

Definition at line 220 of file TGLViewerBase.cxx.

◆ RemoveScene()

void TGLViewerBase::RemoveScene ( TGLSceneBase scene)

Remove scene from the viewer, its scene-info is deleted.

Definition at line 135 of file TGLViewerBase.cxx.

◆ Render()

void TGLViewerBase::Render ( )
virtual

Render all scenes.

This is done in two main passes:

  • render opaque objects from all scenes
  • render transparent objects from all scenes

Reimplemented in TGLViewer.

Definition at line 423 of file TGLViewerBase.cxx.

◆ RenderNonSelected()

void TGLViewerBase::RenderNonSelected ( )
virtual

Render non-selected objects from all scenes.

Definition at line 432 of file TGLViewerBase.cxx.

◆ RenderOpaque()

void TGLViewerBase::RenderOpaque ( Bool_t  rnr_non_selected = kTRUE,
Bool_t  rnr_selected = kTRUE 
)
virtual

Render opaque objects from all scenes.

Definition at line 488 of file TGLViewerBase.cxx.

◆ RenderOverlay()

void TGLViewerBase::RenderOverlay ( Int_t  state,
Bool_t  selection 
)
virtual

Render overlay objects.

Definition at line 528 of file TGLViewerBase.cxx.

◆ RenderSelected()

void TGLViewerBase::RenderSelected ( )
virtual

Render selected objects from all scenes.

Definition at line 450 of file TGLViewerBase.cxx.

◆ RenderSelectedForHighlight()

void TGLViewerBase::RenderSelectedForHighlight ( )
virtual

Render selected objects from all scenes for highlight.

Definition at line 468 of file TGLViewerBase.cxx.

◆ RenderTransparent()

void TGLViewerBase::RenderTransparent ( Bool_t  rnr_non_selected = kTRUE,
Bool_t  rnr_selected = kTRUE 
)
virtual

Render transparent objects from all scenes.

Definition at line 505 of file TGLViewerBase.cxx.

◆ ResetSceneInfos()

void TGLViewerBase::ResetSceneInfos ( )
virtual

Force rebuild of view-dependent scene-info structures.

This should be called before calling render (draw/select) if something that affects camera interest has been changed.

Definition at line 265 of file TGLViewerBase.cxx.

◆ ResolveSelectRecord()

Bool_t TGLViewerBase::ResolveSelectRecord ( TGLSelectRecord rec,
Int_t  recIdx 
)

Process selection record on buffer-position 'recIdx' and fill the data into 'rec'.

Returns TRUE if scene was demangled and an object identified. When FALSE is returned it is still possible that scene has been identified. Check for this if interested in scene-selection.

The select-buffer is taken form fRnrCtx.

Definition at line 601 of file TGLViewerBase.cxx.

◆ RnrCtx()

TGLRnrCtx & TGLViewerBase::RnrCtx ( ) const
inline

Definition at line 159 of file TGLViewerBase.h.

◆ SceneDestructing()

void TGLViewerBase::SceneDestructing ( TGLSceneBase scene)

Remove scene, its scene-info is deleted.

Called from scene that is being destroyed while still holding viewer references.

Definition at line 169 of file TGLViewerBase.cxx.

◆ SetClip()

void TGLViewerBase::SetClip ( TGLClip p)
inline

Definition at line 105 of file TGLViewerBase.h.

◆ SetLOD()

void TGLViewerBase::SetLOD ( Short_t  lod)
inline

Definition at line 108 of file TGLViewerBase.h.

◆ SetOLLineW()

void TGLViewerBase::SetOLLineW ( Float_t  w)
inline

Definition at line 116 of file TGLViewerBase.h.

◆ SetStyle()

void TGLViewerBase::SetStyle ( Short_t  st)
inline

Definition at line 111 of file TGLViewerBase.h.

◆ SetupClipObject()

void TGLViewerBase::SetupClipObject ( )
protectedvirtual

Setup clip-object. Protected virtual method.

Reimplemented in TGLViewer.

Definition at line 299 of file TGLViewerBase.cxx.

◆ SetWFLineW()

void TGLViewerBase::SetWFLineW ( Float_t  w)
inline

Definition at line 114 of file TGLViewerBase.h.

◆ Style()

Short_t TGLViewerBase::Style ( ) const
inline

Definition at line 110 of file TGLViewerBase.h.

◆ SubRenderScenes()

void TGLViewerBase::SubRenderScenes ( SubRender_foo  render_foo)
protected

Call sub-rendering function render_foo on all currently visible scenes.

Definition at line 400 of file TGLViewerBase.cxx.

◆ WFLineW()

Float_t TGLViewerBase::WFLineW ( ) const
inline

Definition at line 113 of file TGLViewerBase.h.

Member Data Documentation

◆ fCamera

TGLCamera* TGLViewerBase::fCamera
protected

Definition at line 64 of file TGLViewerBase.h.

◆ fChanged

Bool_t TGLViewerBase::fChanged
protected

Definition at line 72 of file TGLViewerBase.h.

◆ fClip

TGLClip* TGLViewerBase::fClip
protected

Definition at line 65 of file TGLViewerBase.h.

◆ fLOD

Short_t TGLViewerBase::fLOD
protected

Definition at line 66 of file TGLViewerBase.h.

◆ fOLLineW

Float_t TGLViewerBase::fOLLineW
protected

Definition at line 69 of file TGLViewerBase.h.

◆ fOverallBoundingBox

TGLBoundingBox TGLViewerBase::fOverallBoundingBox
protected

Definition at line 77 of file TGLViewerBase.h.

◆ fOverlay

OverlayElmVec_t TGLViewerBase::fOverlay
protected

Definition at line 79 of file TGLViewerBase.h.

◆ fResetSceneInfosOnRender

Bool_t TGLViewerBase::fResetSceneInfosOnRender
protected

Definition at line 71 of file TGLViewerBase.h.

◆ fRnrCtx

TGLRnrCtx* TGLViewerBase::fRnrCtx
protected

Definition at line 62 of file TGLViewerBase.h.

◆ fScenes

SceneInfoList_t TGLViewerBase::fScenes
protected

Definition at line 74 of file TGLViewerBase.h.

◆ fStyle

Short_t TGLViewerBase::fStyle
protected

Definition at line 67 of file TGLViewerBase.h.

◆ fVisScenes

SceneInfoVec_t TGLViewerBase::fVisScenes
protected

Definition at line 75 of file TGLViewerBase.h.

◆ fWFLineW

Float_t TGLViewerBase::fWFLineW
protected

Definition at line 68 of file TGLViewerBase.h.

Libraries for TGLViewerBase:
[legend]

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