Logo ROOT   6.12/07
Reference Guide
TGLViewer.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Richard Maunder 25/05/2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGLViewer
13 #define ROOT_TGLViewer
14 
15 #include "TGLViewerBase.h"
16 #include "TGLRnrCtx.h"
17 #include "TGLSelectRecord.h"
18 
19 #include "TVirtualViewer3D.h"
20 #include "TBuffer3D.h"
21 
22 #include "TGLPerspectiveCamera.h"
23 #include "TGLOrthoCamera.h"
24 #include "TGLClip.h"
25 
26 #include "TTimer.h"
27 #include "TPoint.h"
28 
29 #include "TGEventHandler.h"
30 
31 #include "GuiTypes.h"
32 #include "TQObject.h"
33 
34 #include <vector>
35 
36 class TGLSceneBase;
37 class TGLRedrawTimer;
38 class TGLViewerEditor;
39 class TGLWidget;
40 class TGLLightSet;
41 class TGLClipSet;
42 class TGLManipSet;
43 class TGLCameraOverlay;
44 class TGLContextIdentity;
45 class TGLAutoRotator;
46 class TTimer;
47 class TImage;
48 
49 class TContextMenu;
50 class TGedEditor;
51 class TGLPShapeObj;
52 
53 class TGLViewer : public TVirtualViewer3D,
54  public TGLViewerBase,
55  public TQObject
56 
57 {
58  friend class TGLOutput;
59  friend class TGLEventHandler;
60  friend class TGLAutoRotator;
61 public:
62 
66 
67  enum ESecSelType { // When to do secondary-selection:
68  kOnRequest, // - on request - when Mod1 is pressed or logical-shape requests it;
69  kOnKeyMod1 // - only when Mod1 is pressed.
70  };
71 
72 private:
73  TGLViewer(const TGLViewer &); // Not implemented
74  TGLViewer & operator=(const TGLViewer &); // Not implemented
75 
76  void InitSecondaryObjects();
77 
78 protected:
79  // External handles
80  TVirtualPad *fPad; //! external pad - remove replace with signal
81 
82  // GUI Handles
84 
85  // Cameras
86  // TODO: Put in vector and allow external creation
100 
101  // Stereo
102  Bool_t fStereo; //! use stereo rendering
103  Bool_t fStereoQuadBuf; //! draw quad buffer or left/right stereo in left/right half of window
104  Float_t fStereoZeroParallax; //! position of zero-parallax plane: 0 - near clipping plane, 1 - far clipping plane
107 
108  // Lights
110  // Clipping
112  // Selected physical
113  TGLSelectRecord fCurrentSelRec; //! select record in use as selected
114  TGLSelectRecord fSelRec; //! select record from last select (should go to context)
115  TGLSelectRecord fSecSelRec; //! select record from last secondary select (should go to context)
117  // Overlay
118  TGLOverlayElement *fCurrentOvlElm; //! current overlay element
119  TGLOvlSelectRecord fOvlSelRec; //! select record from last overlay select
120 
121  TGEventHandler *fEventHandler; //! event handler
122  TGedEditor *fGedEditor; //! GED editor
124 
125  // Mouse ineraction
126 public:
132 protected:
135 
136  // Redraw timer
137  TGLRedrawTimer *fRedrawTimer; //! timer for triggering redraws
138  Float_t fMaxSceneDrawTimeHQ; //! max time for scene rendering at high LOD (in ms)
139  Float_t fMaxSceneDrawTimeLQ; //! max time for scene rendering at high LOD (in ms)
140 
141  TGLRect fViewport; //! viewport - drawn area
142  TGLColorSet fDarkColorSet; //! color-set with dark background
143  TGLColorSet fLightColorSet; //! color-set with light background
144  Float_t fPointScale; //! size scale for points
145  Float_t fLineScale; //! width scale for lines
146  Bool_t fSmoothPoints; //! smooth point edge rendering
147  Bool_t fSmoothLines; //! smooth line edge rendering
148  Int_t fAxesType; //! axes type
149  Bool_t fAxesDepthTest; //! remove guides hidden-lines
150  Bool_t fReferenceOn; //! reference marker on?
151  TGLVertex3 fReferencePos; //! reference position
152  Bool_t fDrawCameraCenter; //! reference marker on?
153  TGLCameraOverlay *fCameraOverlay; //! markup size of viewport in scene units
154 
155  Bool_t fSmartRefresh; //! cache logicals during scene rebuilds
156 
157  // Debug tracing (for scene rebuilds)
158  Bool_t fDebugMode; //! debug mode (forced rebuild + draw scene/frustum/interest boxes)
160  TString fPictureFileName; //! default file-name for SavePicture()
161  Float_t fFader; //! fade the view (0 - no fade/default, 1 - full fade/no rendering done)
162 
163  static TGLColorSet fgDefaultColorSet; //! a shared, default color-set
164  static Bool_t fgUseDefaultColorSetForNewViewers; //! name says it all
165 
166 
167  ///////////////////////////////////////////////////////////////////////
168  // Methods
169  ///////////////////////////////////////////////////////////////////////
170 
171  virtual void SetupClipObject();
172 
173  // Drawing - can tidy up/remove lots when TGLManager added
174  void InitGL();
175  void PreDraw();
176  void PostDraw();
177  void FadeView(Float_t alpha);
178  void MakeCurrent() const;
179  void SwapBuffers() const;
180 
181  // Cameras
182  void SetViewport(Int_t x, Int_t y, Int_t width, Int_t height);
183  void SetViewport(const TGLRect& vp);
184  void SetupCameras(Bool_t reset);
185 
186 protected:
188  Int_t fGLDevice; //!for embedded gl viewer
189  TGLContextIdentity *fGLCtxId; //!for embedded gl viewer
190 
191  // Updata/camera-reset behaviour
192  Bool_t fIgnoreSizesOnUpdate; // ignore sizes of bounding-boxes on update
193  Bool_t fResetCamerasOnUpdate; // reposition camera on each update
194  Bool_t fResetCamerasOnNextUpdate; // reposition camera on next update
195 
196 public:
197  TGLViewer(TVirtualPad* pad, Int_t x, Int_t y, Int_t width, Int_t height);
198  TGLViewer(TVirtualPad* pad);
199  virtual ~TGLViewer();
200 
201  // TVirtualViewer3D interface ... mostly a facade
202 
203  // Forward to TGLScenePad
204  virtual Bool_t CanLoopOnPrimitives() const { return kTRUE; }
205  virtual void PadPaint(TVirtualPad* pad);
206  // Actually used by GL-in-pad
207  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
208  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
209  // Only implemented because they're abstract ... should throw an
210  // exception or assert they are not called.
211  virtual Bool_t PreferLocalFrame() const { return kTRUE; }
212  virtual void BeginScene() {}
213  virtual Bool_t BuildingScene() const { return kFALSE; }
214  virtual void EndScene() {}
215  virtual Int_t AddObject(const TBuffer3D&, Bool_t* = 0) { return TBuffer3D::kNone; }
216  virtual Int_t AddObject(UInt_t, const TBuffer3D&, Bool_t* = 0) { return TBuffer3D::kNone; }
217  virtual Bool_t OpenComposite(const TBuffer3D&, Bool_t* = 0) { return kFALSE; }
218  virtual void CloseComposite() {}
219  virtual void AddCompositeOp(UInt_t) {}
220 
221  virtual void PrintObjects();
222  virtual void ResetCameras() { SetupCameras(kTRUE); }
223  virtual void ResetCamerasAfterNextUpdate() { fResetCamerasOnNextUpdate = kTRUE; }
224 
226 
227  virtual void CreateGLWidget() {}
228  virtual void DestroyGLWidget() {}
229 
230  Int_t GetDev() const { return fGLDevice; }
232  void SetSmartRefresh(Bool_t smart_ref) { fSmartRefresh = smart_ref; }
233 
237  void UseDarkColorSet();
238  void UseLightColorSet();
239  void SwitchColorSet();
240 
243  Bool_t IsColorSetDark() const;
244 
245  void SetClearColor(Color_t col);
246 
250 
251  const TGLRect& RefViewport() const { return fViewport; }
252  Int_t ViewportDiagonal() const { return fViewport.Diagonal(); }
253 
254  Float_t GetPointScale() const { return fPointScale; }
255  Float_t GetLineScale() const { return fLineScale; }
256  void SetPointScale(Float_t s) { fPointScale = s; }
257  void SetLineScale (Float_t s) { fLineScale = s; }
259  Bool_t GetSmoothLines() const { return fSmoothLines; }
260  void SetSmoothPoints(Bool_t s){ fSmoothPoints = s; }
261  void SetSmoothLines(Bool_t s) { fSmoothLines = s; }
262 
263  TGLLightSet* GetLightSet() const { return fLightSet; }
264  TGLClipSet * GetClipSet() const { return fClipSet; }
265  Bool_t GetClipAutoUpdate() const { return fClipSet->GetAutoUpdate(); }
266  void SetClipAutoUpdate(Bool_t x) { fClipSet->SetAutoUpdate(x); }
267 
268  // External GUI component interface
269  TGLCamera & CurrentCamera() const { return *fCurrentCamera; }
270  TGLCamera & RefCamera(ECameraType camera);
271  void SetCurrentCamera(ECameraType camera);
272  void SetOrthoCamera(ECameraType camera, Double_t zoom, Double_t dolly,
273  Double_t center[3], Double_t hRotate, Double_t vRotate);
274  void SetPerspectiveCamera(ECameraType camera, Double_t fov, Double_t dolly,
275  Double_t center[3], Double_t hRotate, Double_t vRotate);
276  void ReinitializeCurrentCamera(const TGLVector3& hAxis, const TGLVector3& vAxis, Bool_t redraw=kTRUE);
277  void GetGuideState(Int_t & axesType, Bool_t & axesDepthTest, Bool_t & referenceOn, Double_t* referencePos) const;
278  void SetGuideState(Int_t axesType, Bool_t axesDepthTest, Bool_t referenceOn, const Double_t* referencePos);
279  void SetDrawCameraCenter(Bool_t x);
281  void PickCameraCenter() { fPushAction = kPushCamCenter; RefreshPadEditor(this); }
282  void PickAnnotate() { fPushAction = kPushAnnotate; RefreshPadEditor(this); }
284  void SetCameraOverlay(TGLCameraOverlay* m) { fCameraOverlay = m; }
286  void SetAutoRotator(TGLAutoRotator* ar);
287 
288  // Stereo
289  Bool_t GetStereo() const { return fStereo; }
293 
294  void SetStereo(Bool_t stereo, Bool_t quad_buf=kTRUE);
295  void SetStereoZeroParallax(Float_t f) { fStereoZeroParallax = f; }
296  void SetStereoEyeOffsetFac(Float_t f) { fStereoEyeOffsetFac = f; }
297  void SetStereoFrustumAsymFac(Float_t f) { fStereoFrustumAsymFac = f; }
298 
299  // Push / drag action
302 
303  const TGLPhysicalShape * GetSelected() const;
304 
305 
306  // Draw and selection
307 
308  // Scene rendering timeouts
311  void SetMaxSceneDrawTimeHQ(Float_t t) { fMaxSceneDrawTimeHQ = t; }
312  void SetMaxSceneDrawTimeLQ(Float_t t) { fMaxSceneDrawTimeLQ = t; }
313 
314  // Request methods post cross thread request via TROOT::ProcessLineFast().
315  void RequestDraw(Short_t LOD = TGLRnrCtx::kLODMed); // Cross thread draw request
316  virtual void PreRender();
317  virtual void Render();
318  virtual void PostRender();
319  void DoDraw(Bool_t swap_buffers=kTRUE);
320  void DoDrawMono(Bool_t swap_buffers);
321  void DoDrawStereo(Bool_t swap_buffers);
322 
323  void DrawGuides();
324  void DrawDebugInfo();
325 
326  Bool_t RequestSelect(Int_t x, Int_t y); // Cross thread select request
327  Bool_t DoSelect(Int_t x, Int_t y); // First level selecton (shapes/objects).
328  Bool_t RequestSecondarySelect(Int_t x, Int_t y); // Cross thread secondary select request
329  Bool_t DoSecondarySelect(Int_t x, Int_t y); // Second level selecton (inner structure).
330  void ApplySelection();
331 
332  Bool_t RequestOverlaySelect(Int_t x, Int_t y); // Cross thread select request
333  Bool_t DoOverlaySelect(Int_t x, Int_t y); // Window coords origin top left
334 
335  // Saving of screen image
337  Bool_t SavePicture(const TString &fileName);
338  Bool_t SavePictureUsingBB (const TString &fileName);
339  Bool_t SavePictureUsingFBO(const TString &fileName, Int_t w, Int_t h, Float_t pixel_object_scale=0);
340  Bool_t SavePictureWidth (const TString &fileName, Int_t width, Bool_t pixel_object_scale=kTRUE);
341  Bool_t SavePictureHeight(const TString &fileName, Int_t height, Bool_t pixel_object_scale=kTRUE);
342  Bool_t SavePictureScale (const TString &fileName, Float_t scale, Bool_t pixel_object_scale=kTRUE);
343 
344  // Methods returning screen image
346  TImage* GetPictureUsingFBO(Int_t w, Int_t h,Float_t pixel_object_scale=0);
347 
348  const char* GetPictureFileName() const { return fPictureFileName.Data(); }
349  void SetPictureFileName(const TString& f) { fPictureFileName = f; }
350  Float_t GetFader() const { return fFader; }
351  void SetFader(Float_t x) { fFader = x; }
352  void AutoFade(Float_t fade, Float_t time=1, Int_t steps=10);
353 
354  // Update/camera-reset
355  void UpdateScene(Bool_t redraw=kTRUE);
357  void SetIgnoreSizesOnUpdate(Bool_t v) { fIgnoreSizesOnUpdate = v; }
358  void ResetCurrentCamera();
360  void SetResetCamerasOnUpdate(Bool_t v) { fResetCamerasOnUpdate = v; }
361 
362  virtual void PostSceneBuildSetup(Bool_t resetCameras);
363 
364  virtual void Activated() { Emit("Activated()"); } // *SIGNAL*
365 
366  virtual void MouseIdle(TGLPhysicalShape*,UInt_t,UInt_t); // *SIGNAL*
367  virtual void MouseOver(TGLPhysicalShape*); // *SIGNAL*
368  virtual void MouseOver(TGLPhysicalShape*, UInt_t state); // *SIGNAL*
369  virtual void MouseOver(TObject *obj, UInt_t state); // *SIGNAL*
370  virtual void ReMouseOver(TObject *obj, UInt_t state); // *SIGNAL*
371  virtual void UnMouseOver(TObject *obj, UInt_t state); // *SIGNAL*
372 
373  virtual void Clicked(TObject *obj); //*SIGNAL*
374  virtual void Clicked(TObject *obj, UInt_t button, UInt_t state); //*SIGNAL*
375  virtual void ReClicked(TObject *obj, UInt_t button, UInt_t state); //*SIGNAL*
376  virtual void UnClicked(TObject *obj, UInt_t button, UInt_t state); //*SIGNAL*
377  virtual void DoubleClicked() { Emit("DoubleClicked()"); } // *SIGNAL*
378 
380  virtual void SetEventHandler(TGEventHandler *handler);
381 
382  TGedEditor* GetGedEditor() const { return fGedEditor; }
383  virtual void SetGedEditor(TGedEditor* ed) { fGedEditor = ed; }
384 
385  virtual void SelectionChanged();
386  virtual void OverlayDragFinished();
387  virtual void RefreshPadEditor(TObject* obj=0);
388 
389  virtual void RemoveOverlayElement(TGLOverlayElement* el);
390 
394  void ClearCurrentOvlElm();
395 
396  ClassDef(TGLViewer,0) // Standard ROOT GL viewer.
397 };
398 
399 
400 
401 // TODO: Find a better place/way to do this
402 class TGLRedrawTimer : public TTimer
403 {
404 private:
408 public:
410  fViewer(viewer), fRedrawLOD(TGLRnrCtx::kLODHigh), fPending(kFALSE) {}
412  void RequestDraw(Int_t milliSec, Short_t redrawLOD)
413  {
414  if (fPending) TurnOff(); else fPending = kTRUE;
415  if (redrawLOD < fRedrawLOD) fRedrawLOD = redrawLOD;
416  TTimer::Start(milliSec, kTRUE);
417  }
418  Bool_t IsPending() const { return fPending; }
419  virtual void Stop()
420  {
421  if (fPending) { TurnOff(); fPending = kFALSE; }
422  }
424  {
425  TurnOff();
426  fPending = kFALSE;
427  fViewer.RequestDraw(fRedrawLOD);
428  fRedrawLOD = TGLRnrCtx::kLODHigh;
429  return kTRUE;
430  }
431 };
432 
434 private:
435  TGLFaderHelper(const TGLFaderHelper&); // Not implemented
436  TGLFaderHelper& operator=(const TGLFaderHelper&); // Not implemented
437 
438 public:
443 
445  fViewer(0), fFadeTarget(0), fTime(0), fNSteps(0) {}
447  fViewer(v),fFadeTarget(fade), fTime(time), fNSteps(steps) {}
448  virtual ~TGLFaderHelper() {}
449 
450  void MakeFadeStep();
451 
453 };
454 
455 #endif // ROOT_TGLViewer
TGEventHandler * fEventHandler
select record from last overlay select
Definition: TGLViewer.h:121
void FadeView(Float_t alpha)
Draw a rectangle (background color and given alpha) across the whole viewport.
Definition: TGLViewer.cxx:1254
Int_t fAxesType
smooth line edge rendering
Definition: TGLViewer.h:148
TGLCamera * fCurrentCamera
Definition: TGLViewer.h:98
Float_t fTime
Definition: TGLViewer.h:441
A GL overlay element which displays camera furstum.
virtual void Stop()
Definition: TGLViewer.h:419
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition: TGLRnrCtx.h:40
TGLVertex3 fReferencePos
reference marker on?
Definition: TGLViewer.h:151
virtual void ReMouseOver(TObject *obj, UInt_t state)
Emit MouseOver signal.
Definition: TGLViewer.cxx:2127
Class encapsulating a set of colors used throughout standard rendering.
Definition: TGLUtil.h:834
TGLSelectRecord fSelRec
select record in use as selected
Definition: TGLViewer.h:114
TString fPictureFileName
Definition: TGLViewer.h:160
Bool_t fStereoQuadBuf
use stereo rendering
Definition: TGLViewer.h:103
Short_t fRedrawLOD
Definition: TGLViewer.h:406
TGLClipSet * GetClipSet() const
Definition: TGLViewer.h:264
const TGLRect & RefViewport() const
Definition: TGLViewer.h:251
TGLColorSet fLightColorSet
color-set with dark background
Definition: TGLViewer.h:143
void MakeCurrent() const
Make GL context current.
Definition: TGLViewer.cxx:1279
virtual void PadPaint(TVirtualPad *pad)
Entry point for updating viewer contents via VirtualViewer3D interface.
Definition: TGLViewer.cxx:306
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition: TGLCamera.h:43
TGLPerspectiveCamera fPerspectiveCameraXOZ
Definition: TGLViewer.h:87
virtual void PreRender()
Initialize objects that influence rendering.
Definition: TGLViewer.cxx:485
auto * m
Definition: textangle.C:8
void ReinitializeCurrentCamera(const TGLVector3 &hAxis, const TGLVector3 &vAxis, Bool_t redraw=kTRUE)
Change base-vectors defining the camera-base transformation of current camera.
Definition: TGLViewer.cxx:1989
Float_t fLineScale
size scale for points
Definition: TGLViewer.h:145
Wrap TGLPysicalShape into TObject so that it can be edited using GED.
Definition: TGLPShapeObj.h:20
float Float_t
Definition: RtypesCore.h:53
TGEventHandler * GetEventHandler() const
Definition: TGLViewer.h:379
virtual void MouseOver(TGLPhysicalShape *)
Emit MouseOver signal.
Definition: TGLViewer.cxx:2097
void SwitchColorSet()
Switch between dark and light colorsets.
Definition: TGLViewer.cxx:1635
TGLAutoRotator * fAutoRotator
Definition: TGLViewer.h:99
Float_t fFadeTarget
Definition: TGLViewer.h:440
TGLViewer & fViewer
Definition: TGLViewer.h:405
virtual Bool_t OpenComposite(const TBuffer3D &, Bool_t *=0)
Definition: TGLViewer.h:217
virtual void ResetCamerasAfterNextUpdate()
Definition: TGLViewer.h:223
Bool_t GetStereo() const
Definition: TGLViewer.h:289
TGLOverlayElement * GetCurrentOvlElm() const
Definition: TGLViewer.h:393
TH1 * h
Definition: legend2.C:5
TGLOrthoCamera fOrthoXnOZCamera
Definition: TGLViewer.h:95
Identifier of a shared GL-context.
Definition: TGLContext.h:80
void ResetCurrentCamera()
Resets position/rotation of current camera to default values.
Definition: TGLViewer.cxx:360
void SetupCameras(Bool_t reset)
Setup cameras for current bounding box.
Definition: TGLViewer.cxx:369
TGLOrthoCamera fOrthoXOZCamera
Definition: TGLViewer.h:91
static TGLColorSet & GetDefaultColorSet()
Returns reference to the default color-set.
Definition: TGLViewer.cxx:1683
TGLOrthoCamera fOrthoXOYCamera
Definition: TGLViewer.h:90
TGLCamera & RefCamera(ECameraType camera)
Return camera reference by type.
Definition: TGLViewer.cxx:1756
Bool_t RequestOverlaySelect(Int_t x, Int_t y)
Post request for secondary selection rendering of selected object around the window point (x...
Definition: TGLViewer.cxx:1491
virtual void SetEventHandler(TGEventHandler *handler)
Set the event-handler.
Definition: TGLViewer.cxx:2293
This is the ROOT implementation of the Qt object communication mechanism (see also http://www...
Definition: TQObject.h:49
Scene base-class – provides basic interface expected by the TGLViewer or its sub-classes: ...
Definition: TGLSceneBase.h:32
Float_t fStereoEyeOffsetFac
position of zero-parallax plane: 0 - near clipping plane, 1 - far clipping plane
Definition: TGLViewer.h:105
TGLViewer * fViewer
Definition: TGLViewer.h:439
TGLViewer & operator=(const TGLViewer &)
void DoDraw(Bool_t swap_buffers=kTRUE)
Draw out the viewer.
Definition: TGLViewer.cxx:550
Bool_t IsColorSetDark() const
Returns true if current color set is dark.
Definition: TGLViewer.cxx:1711
Basic string class.
Definition: TString.h:125
void SetCameraOverlay(TGLCameraOverlay *m)
Definition: TGLViewer.h:284
void SetSmoothPoints(Bool_t s)
Definition: TGLViewer.h:260
Bool_t SavePictureScale(const TString &fileName, Float_t scale, Bool_t pixel_object_scale=kTRUE)
Save picture with given scale to current window size.
Definition: TGLViewer.cxx:1146
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TGLColorSet & RefLightColorSet()
Definition: TGLViewer.h:235
const TGLPhysicalShape * GetSelected() const
Return selected physical shape.
Definition: TGLViewer.cxx:2086
void SetMaxSceneDrawTimeLQ(Float_t t)
Definition: TGLViewer.h:312
void SetDrawCameraCenter(Bool_t x)
Draw camera look at and rotation point.
Definition: TGLViewer.cxx:2076
GUI editor for TGLViewer.
An abstract interface to image processing library.
Definition: TImage.h:29
Bool_t SavePictureHeight(const TString &fileName, Int_t height, Bool_t pixel_object_scale=kTRUE)
Save picture with given height (width scaled proportionally).
Definition: TGLViewer.cxx:1132
Bool_t RequestSecondarySelect(Int_t x, Int_t y)
Request secondary select.
Definition: TGLViewer.cxx:1384
virtual void UnMouseOver(TObject *obj, UInt_t state)
Emit UnMouseOver signal.
Definition: TGLViewer.cxx:2139
virtual void SetGedEditor(TGedEditor *ed)
Definition: TGLViewer.h:383
Perspective projection camera - with characteristic foreshortening.
virtual void PostRender()
Restore state set in PreRender().
Definition: TGLViewer.cxx:539
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Process event of type &#39;event&#39; - one of EEventType types, occurring at window location px...
Definition: TGLViewer.cxx:2230
Encapsulates a set of lights for OpenGL.
Definition: TGLLightSet.h:21
void UseLightColorSet()
Use the light color-set.
Definition: TGLViewer.cxx:1626
Combine all available manipulators in a collection.
Definition: TGLManipSet.h:21
An overlay element.
Definition: TGLOverlay.h:22
static void UseDefaultColorSetForNewViewers(Bool_t x)
Sets static flag that determines if new viewers should use the default color-set. ...
Definition: TGLViewer.cxx:1693
void SetOrthoCamera(ECameraType camera, Double_t zoom, Double_t dolly, Double_t center[3], Double_t hRotate, Double_t vRotate)
Set an orthographic camera to supplied configuration - note this does not need to be the current came...
Definition: TGLViewer.cxx:1894
Wrapper class for GL capture & output routines.
Definition: TGLOutput.h:26
Bool_t GetResetCamerasOnUpdate() const
Definition: TGLViewer.h:359
void SetClearColor(Color_t col)
Set background method.
Definition: TGLViewer.cxx:1674
Base class for GL viewers.
Definition: TGLViewerBase.h:36
Concrete physical shape - a GL drawable.
TGLCamera & CurrentCamera() const
Definition: TGLViewer.h:269
virtual Bool_t CanLoopOnPrimitives() const
Definition: TGLViewer.h:204
Float_t GetStereoFrustumAsymFac() const
Definition: TGLViewer.h:292
virtual void Render()
Normal rendering, used by mono and stereo rendering.
Definition: TGLViewer.cxx:519
void AutoFade(Float_t fade, Float_t time=1, Int_t steps=10)
Animate fading from current value to fade over given time (sec) and number of steps.
Definition: TGLViewer.cxx:1608
static TGLColorSet fgDefaultColorSet
fade the view (0 - no fade/default, 1 - full fade/no rendering done)
Definition: TGLViewer.h:163
void SetPointScale(Float_t s)
Definition: TGLViewer.h:256
EDragAction GetDragAction() const
Definition: TGLViewer.h:301
Short_t LOD() const
TGLSelectRecord fCurrentSelRec
Definition: TGLViewer.h:113
void SetLineScale(Float_t s)
Definition: TGLViewer.h:257
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:320
virtual void OverlayDragFinished()
An overlay operation can result in change to an object.
Definition: TGLViewer.cxx:2267
Bool_t fDebugMode
cache logicals during scene rebuilds
Definition: TGLViewer.h:158
TGLRedrawTimer * fRedrawTimer
Definition: TGLViewer.h:137
TGLRnrCtx * fRnrCtx
Definition: TGLViewerBase.h:62
3 component (x/y/z) vertex class.
Definition: TGLUtil.h:82
void SetFader(Float_t x)
Definition: TGLViewer.h:351
TGLContextIdentity * fGLCtxId
for embedded gl viewer
Definition: TGLViewer.h:189
virtual void PostSceneBuildSetup(Bool_t resetCameras)
Perform post scene-build setup.
Definition: TGLViewer.cxx:394
virtual void Start(Long_t milliSec=-1, Bool_t singleShot=kFALSE)
Starts the timer with a milliSec timeout.
Definition: TTimer.cxx:211
void PostDraw()
Perform GL work which must be done after each draw.
Definition: TGLViewer.cxx:1244
Bool_t GetIgnoreSizesOnUpdate() const
Definition: TGLViewer.h:356
Bool_t GetSmoothLines() const
Definition: TGLViewer.h:259
const char * GetPictureFileName() const
Definition: TGLViewer.h:348
Viewport (pixel base) 2D rectangle class.
Definition: TGLUtil.h:422
Bool_t fResetCamerasOnUpdate
Definition: TGLViewer.h:193
void SwapBuffers() const
Swap GL buffers.
Definition: TGLViewer.cxx:1290
Bool_t DoSecondarySelect(Int_t x, Int_t y)
Secondary selection.
Definition: TGLViewer.cxx:1399
Abstract 3D shapes viewer.
3 component (x/y/z) vector class.
Definition: TGLUtil.h:246
virtual void RemoveOverlayElement(TGLOverlayElement *el)
Remove overlay element.
Definition: TGLViewer.cxx:2306
Int_t ViewportDiagonal() const
Definition: TGLViewer.h:252
TVirtualPad * fPad
Definition: TGLViewer.h:80
TGedEditor * GetGedEditor() const
Definition: TGLViewer.h:382
void DrawGuides()
Draw reference marker and coordinate axes.
Definition: TGLViewer.cxx:1158
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:49
Float_t GetFader() const
Definition: TGLViewer.h:350
void ApplySelection()
Process result from last selection (in fSelRec) and extract a new current selection from it...
Definition: TGLViewer.cxx:1474
Bool_t fAxesDepthTest
axes type
Definition: TGLViewer.h:149
virtual ~TGLFaderHelper()
Definition: TGLViewer.h:448
void SetSmartRefresh(Bool_t smart_ref)
Definition: TGLViewer.h:232
short Color_t
Definition: RtypesCore.h:79
TGLWidget * fGLWidget
Definition: TGLViewer.h:187
Float_t GetStereoEyeOffsetFac() const
Definition: TGLViewer.h:291
Bool_t GetSmartRefresh() const
Definition: TGLViewer.h:231
TGLManipSet * fSelectedPShapeRef
select record from last secondary select (should go to context)
Definition: TGLViewer.h:116
Bool_t GetClipAutoUpdate() const
Definition: TGLViewer.h:265
Float_t fMaxSceneDrawTimeLQ
max time for scene rendering at high LOD (in ms)
Definition: TGLViewer.h:139
void UpdateScene(Bool_t redraw=kTRUE)
Force update of pad-scenes.
Definition: TGLViewer.cxx:338
TGLSelectRecord & GetSelRec()
Definition: TGLViewer.h:391
void InitGL()
Initialise GL state.
Definition: TGLViewer.cxx:411
virtual Int_t AddObject(UInt_t, const TBuffer3D &, Bool_t *=0)
Definition: TGLViewer.h:216
void SetPerspectiveCamera(ECameraType camera, Double_t fov, Double_t dolly, Double_t center[3], Double_t hRotate, Double_t vRotate)
Set a perspective camera to supplied configuration - note this does not need to be the current camera...
Definition: TGLViewer.cxx:1949
Float_t fFader
default file-name for SavePicture()
Definition: TGLViewer.h:161
void PickCameraCenter()
Definition: TGLViewer.h:281
Bool_t IsUsingDefaultColorSet() const
Check if the viewer is using the default color set.
Definition: TGLViewer.cxx:1665
Automatically rotates GL camera.
TGLAutoRotator * GetAutoRotator()
Get the auto-rotator for this viewer.
Definition: TGLViewer.cxx:2001
void RequestDraw(Short_t LOD=TGLRnrCtx::kLODMed)
Post request for redraw of viewer at level of detail &#39;LOD&#39; Request is directed via cross thread gVirt...
Definition: TGLViewer.cxx:440
virtual void PrintObjects()
Pass viewer for print capture by TGLOutput.
Definition: TGLViewer.cxx:2239
Bool_t RequestSelect(Int_t x, Int_t y)
Post request for selection render pass viewer, picking objects around the window point (x...
Definition: TGLViewer.cxx:1308
static Bool_t IsUsingDefaultColorSetForNewViewers()
Returns the value of the static flag that determines if new viewers should use the default color-set...
Definition: TGLViewer.cxx:1703
virtual void AddCompositeOp(UInt_t)
Definition: TGLViewer.h:219
SVector< double, 2 > v
Definition: Dict.h:5
void RequestDraw(Int_t milliSec, Short_t redrawLOD)
Definition: TGLViewer.h:412
Bool_t fIsPrinting
debug mode (forced rebuild + draw scene/frustum/interest boxes)
Definition: TGLViewer.h:159
Standard selection record including information about containing scene and details ob out selected ob...
Bool_t GetAutoUpdate() const
Definition: TGLClip.h:188
TGLCameraOverlay * GetCameraOverlay() const
Definition: TGLViewer.h:283
Bool_t SavePictureUsingFBO(const TString &fileName, Int_t w, Int_t h, Float_t pixel_object_scale=0)
Save current image in various formats (gif, gif+, jpg, png).
Definition: TGLViewer.cxx:893
Int_t fGLDevice
Definition: TGLViewer.h:188
This class provides an interface to context sensitive popup menus.
Definition: TContextMenu.h:40
void GetGuideState(Int_t &axesType, Bool_t &axesDepthTest, Bool_t &referenceOn, Double_t *referencePos) const
Fetch the state of guides (axes & reference markers) into arguments.
Definition: TGLViewer.cxx:2047
virtual Int_t AddObject(const TBuffer3D &, Bool_t *=0)
Definition: TGLViewer.h:215
virtual void CreateGLWidget()
Definition: TGLViewer.h:227
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void Clicked(TObject *obj)
Emit Clicked signal.
Definition: TGLViewer.cxx:2150
TGLRect fViewport
max time for scene rendering at high LOD (in ms)
Definition: TGLViewer.h:141
Bool_t fStereo
Definition: TGLViewer.h:102
Bool_t DoOverlaySelect(Int_t x, Int_t y)
Perform GL selection, picking overlay objects only.
Definition: TGLViewer.cxx:1510
void DoDrawStereo(Bool_t swap_buffers)
Draw out in stereoscopic mode.
Definition: TGLViewer.cxx:660
EDragAction fDragAction
Definition: TGLViewer.h:134
void SetStereoZeroParallax(Float_t f)
Definition: TGLViewer.h:295
A collection of concrete TGLClip objects to be selected from.
Definition: TGLClip.h:139
short Short_t
Definition: RtypesCore.h:35
void SetStereoFrustumAsymFac(Float_t f)
Definition: TGLViewer.h:297
virtual void DoubleClicked()
Definition: TGLViewer.h:377
Generic 3D primitive description class.
Definition: TBuffer3D.h:17
TGLOvlSelectRecord fOvlSelRec
current overlay element
Definition: TGLViewer.h:119
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
TGLOvlSelectRecord & GetOvlSelRec()
Definition: TGLViewer.h:392
void UseDarkColorSet()
Use the dark color-set.
Definition: TGLViewer.cxx:1617
Float_t GetMaxSceneDrawTimeLQ() const
Definition: TGLViewer.h:310
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition: TGLViewer.h:53
GL window with context.
Definition: TGLWidget.h:27
Bool_t fSmoothPoints
width scale for lines
Definition: TGLViewer.h:146
void SetStereo(Bool_t stereo, Bool_t quad_buf=kTRUE)
Enable stereo rendering.
Definition: TGLViewer.cxx:2026
Int_t Diagonal() const
Return the diagonal of the rectangle.
Definition: TGLUtil.cxx:316
virtual Bool_t PreferLocalFrame() const
Definition: TGLViewer.h:211
Bool_t DoSelect(Int_t x, Int_t y)
Perform GL selection, picking objects overlapping WINDOW area described by &#39;rect&#39;.
Definition: TGLViewer.cxx:1330
Float_t GetPointScale() const
Definition: TGLViewer.h:254
const Bool_t kFALSE
Definition: RtypesCore.h:88
void SetStereoEyeOffsetFac(Float_t f)
Definition: TGLViewer.h:296
Float_t GetStereoZeroParallax() const
Definition: TGLViewer.h:290
void SetSmoothLines(Bool_t s)
Definition: TGLViewer.h:261
Float_t GetLineScale() const
Definition: TGLViewer.h:255
void SetPictureFileName(const TString &f)
Definition: TGLViewer.h:349
TImage * GetPictureUsingBB()
Returns current image.
Definition: TGLViewer.cxx:987
void SetAutoUpdate(Bool_t aup)
Definition: TGLClip.h:189
Bool_t fSmoothLines
smooth point edge rendering
Definition: TGLViewer.h:147
Bool_t SavePictureWidth(const TString &fileName, Int_t width, Bool_t pixel_object_scale=kTRUE)
Save picture with given width (height scaled proportionally).
Definition: TGLViewer.cxx:1118
double Double_t
Definition: RtypesCore.h:55
void SetViewport(Int_t x, Int_t y, Int_t width, Int_t height)
Set viewer viewport (window area) with bottom/left at (x,y), with dimensions &#39;width&#39;/&#39;height&#39;.
Definition: TGLViewer.cxx:1724
void SetResetCamerasOnUpdate(Bool_t v)
Definition: TGLViewer.h:360
TGLOrthoCamera fOrthoXnOYCamera
Definition: TGLViewer.h:94
EPushAction fPushAction
Definition: TGLViewer.h:133
virtual Bool_t BuildingScene() const
Definition: TGLViewer.h:213
TGLOrthoCamera fOrthoZOYCamera
Definition: TGLViewer.h:92
static Bool_t fgUseDefaultColorSetForNewViewers
a shared, default color-set
Definition: TGLViewer.h:164
Float_t fMaxSceneDrawTimeHQ
timer for triggering redraws
Definition: TGLViewer.h:138
TGLOrthoCamera fOrthoZnOYCamera
Definition: TGLViewer.h:96
virtual void BeginScene()
Definition: TGLViewer.h:212
Base-class and default implementation of event-handler for TGLViewer.
Float_t fStereoZeroParallax
draw quad buffer or left/right stereo in left/right half of window
Definition: TGLViewer.h:104
Double_t y[n]
Definition: legend1.C:17
virtual void SelectionChanged()
Update GUI components for embedded viewer selection change.
Definition: TGLViewer.cxx:2247
virtual void ReClicked(TObject *obj, UInt_t button, UInt_t state)
Emit ReClicked signal with button id and modifier state.
Definition: TGLViewer.cxx:2171
Bool_t fReferenceOn
remove guides hidden-lines
Definition: TGLViewer.h:150
virtual void CloseComposite()
Definition: TGLViewer.h:218
static constexpr double s
void SetCurrentCamera(ECameraType camera)
Set current active camera - &#39;cameraType&#39; one of: kCameraPerspX, kCameraPerspY, kCameraPerspZ, kCameraOrthoXOY, kCameraOrthoXOZ, kCameraOrthoZOY, kCameraOrthoXnOY, kCameraOrthoXnOZ, kCameraOrthoZnOY.
Definition: TGLViewer.cxx:1794
TGLCameraOverlay * fCameraOverlay
reference marker on?
Definition: TGLViewer.h:153
Bool_t fIgnoreSizesOnUpdate
for embedded gl viewer
Definition: TGLViewer.h:192
TContextMenu * fContextMenu
external pad - remove replace with signal
Definition: TGLViewer.h:83
TImage * GetPictureUsingFBO(Int_t w, Int_t h, Float_t pixel_object_scale=0)
Returns current image.
Definition: TGLViewer.cxx:1034
TGLColorSet & RefDarkColorSet()
Definition: TGLViewer.h:234
TGLOverlayElement * fCurrentOvlElm
Definition: TGLViewer.h:118
void DoDrawMono(Bool_t swap_buffers)
Draw out in monoscopic mode.
Definition: TGLViewer.cxx:628
TGLLightSet * GetLightSet() const
Definition: TGLViewer.h:263
Orthographic projection camera.
Mother of all ROOT objects.
Definition: TObject.h:37
TGLViewer(const TGLViewer &)
Float_t fStereoFrustumAsymFac
Definition: TGLViewer.h:106
Bool_t IsPending() const
Definition: TGLViewer.h:418
virtual void RefreshPadEditor(TObject *obj=0)
Update GED editor if it is set.
Definition: TGLViewer.cxx:2278
void ClearCurrentOvlElm()
Reset current overlay-element to zero, eventually notifying the old one that the mouse has left...
Definition: TGLViewer.cxx:2320
Bool_t Notify()
Notify when timer times out.
Definition: TGLViewer.h:423
Bool_t SavePictureUsingBB(const TString &fileName)
Save current image in various formats (gif, gif+, jpg, png).
Definition: TGLViewer.cxx:836
void SetGuideState(Int_t axesType, Bool_t axesDepthTest, Bool_t referenceOn, const Double_t *referencePos)
Set the state of guides (axes & reference markers) from arguments.
Definition: TGLViewer.cxx:2061
TGLColorSet & ColorSet()
Definition: TGLViewer.h:236
void PickAnnotate()
Definition: TGLViewer.h:282
virtual void DestroyGLWidget()
Definition: TGLViewer.h:228
void InitSecondaryObjects()
Common initialization.
Definition: TGLViewer.cxx:242
virtual void MouseIdle(TGLPhysicalShape *, UInt_t, UInt_t)
Emit MouseIdle signal.
Definition: TGLViewer.cxx:2195
EPushAction GetPushAction() const
Definition: TGLViewer.h:300
virtual ~TGLViewer()
Destroy viewer object.
Definition: TGLViewer.cxx:276
void SetClipAutoUpdate(Bool_t x)
Definition: TGLViewer.h:266
virtual void SetupClipObject()
name says it all
Definition: TGLViewer.cxx:470
TGLOrthoCamera fOrthoZOXCamera
Definition: TGLViewer.h:93
TGLPerspectiveCamera fPerspectiveCameraXOY
Definition: TGLViewer.h:89
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Calculate and return pixel distance to nearest viewer object from window location px...
Definition: TGLViewer.cxx:2217
Float_t GetMaxSceneDrawTimeHQ() const
Definition: TGLViewer.h:309
TGLColorSet * GetBaseColorSet()
Returns the current base color-set.
Definition: TGLRnrCtx.cxx:314
virtual void Activated()
Definition: TGLViewer.h:364
virtual void ResetCameras()
Definition: TGLViewer.h:222
void SetMaxSceneDrawTimeHQ(Float_t t)
Definition: TGLViewer.h:311
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:165
Int_t GetDev() const
Definition: TGLViewer.h:230
virtual void UnClicked(TObject *obj, UInt_t button, UInt_t state)
Emit UnClicked signal with button id and modifier state.
Definition: TGLViewer.cxx:2183
Bool_t GetDrawCameraCenter()
Definition: TGLViewer.h:280
TGLLightSet * fLightSet
Definition: TGLViewer.h:109
void PreDraw()
Perform GL work which must be done before each draw.
Definition: TGLViewer.cxx:1219
Selection record for overlay objects.
void UseDefaultColorSet(Bool_t x)
Set usage of the default color set.
Definition: TGLViewer.cxx:1652
void SetAutoRotator(TGLAutoRotator *ar)
Set the auto-rotator for this viewer. The old rotator is deleted.
Definition: TGLViewer.cxx:2011
TGLColorSet fDarkColorSet
viewport - drawn area
Definition: TGLViewer.h:142
TGLRedrawTimer(TGLViewer &viewer)
Definition: TGLViewer.h:409
Bool_t fPending
Definition: TGLViewer.h:407
Bool_t GetSmoothPoints() const
Definition: TGLViewer.h:258
TGedEditor * fGedEditor
event handler
Definition: TGLViewer.h:122
const Bool_t kTRUE
Definition: RtypesCore.h:87
Bool_t fSmartRefresh
markup size of viewport in scene units
Definition: TGLViewer.h:155
TGLClipSet * fClipSet
Definition: TGLViewer.h:111
Float_t fPointScale
color-set with light background
Definition: TGLViewer.h:144
TGLPerspectiveCamera fPerspectiveCameraYOZ
Definition: TGLViewer.h:88
Bool_t fDrawCameraCenter
reference position
Definition: TGLViewer.h:152
Bool_t SavePicture()
Save current image using the default file name which can be set via SetPictureFileName() and defaults...
Definition: TGLViewer.cxx:785
void SetIgnoreSizesOnUpdate(Bool_t v)
Definition: TGLViewer.h:357
TGLFaderHelper(TGLViewer *v, Float_t fade, Float_t time, Int_t steps)
Definition: TGLViewer.h:446
TGLPShapeObj * fPShapeWrap
GED editor.
Definition: TGLViewer.h:123
TGLSelectRecord fSecSelRec
select record from last select (should go to context)
Definition: TGLViewer.h:115
void DrawDebugInfo()
If in debug mode draw camera aids and overall bounding box.
Definition: TGLViewer.cxx:1193
const char * Data() const
Definition: TString.h:345
Bool_t fResetCamerasOnNextUpdate
Definition: TGLViewer.h:194
TGLWidget * GetGLWidget()
Definition: TGLViewer.h:225
virtual void EndScene()
Definition: TGLViewer.h:214
TGLOrthoCamera fOrthoZnOXCamera
Definition: TGLViewer.h:97