Logo ROOT  
Reference Guide
No Matches
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Matevz Tadel, Feb 2007
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 *************************************************************************/
12#ifndef ROOT_TGLRnrCtx
13#define ROOT_TGLRnrCtx
15#include "Rtypes.h"
16#include "TGLStopwatch.h"
18#include <list>
20class TGLViewerBase;
21class TGLCamera;
22class TGLSceneBase;
23class TGLSceneInfo;
25class TGLColorSet;
26class TGLFont;
29class TGLClip;
30class TGLSelectBuffer;
32class TGLRect;
34class GLUquadric;
37// TGLRnrCtx
43 enum EStyle
44 {
49 };
50 static const char* StyleName(Short_t style);
52 enum EPass
53 {
59 };
62 {
64 kLODPixel = 0, // Projected size pixel or less
65 kLODLow = 20,
66 kLODMed = 50,
67 kLODHigh = 100
68 };
71 {
78 };
81 {
84 kNever
85 };
88 TGLRnrCtx(const TGLRnrCtx&) = delete;
89 TGLRnrCtx& operator=(const TGLRnrCtx&) = delete;
91 typedef std::list<TGLColorSet*> lpTGLColorSet_t;
100 Short_t fCombiLOD; // Combined viewer/scene lod.
101 Short_t fShapeLOD; // LOD calculated for current shape.
102 Float_t fShapePixSize; // Only relevant when not using display lists.
123 // Highlight / Selection stuff
124 Bool_t fHighlight; // True when in highlight.
125 Bool_t fHighlightOutline; // True when in highlight-outline.
126 Bool_t fSelection; // True when in selection.
127 Bool_t fSecSelection; // True when in secondary selection.
138 // GL state
139 Bool_t fDLCaptureOpen; //! DL-capture currently open
140 TGLContextIdentity *fGLCtxIdentity; //! Current GL context identity
142 GLUquadric *fQuadric;
144 // Picture grabbing
145 Bool_t fGrabImage; // Set to true to store the image.
146 Int_t fGrabBuffer; // Which buffer to grab after render.
147 UChar_t *fGrabbedImage; // Buffer where image was stored after rendering.
150 TGLRnrCtx(TGLViewerBase* viewer);
151 virtual ~TGLRnrCtx();
153 // Central objects
157 TGLCamera & RefCamera() { return *fCamera; }
163 const TGLCamera & RefCamera() const { return *fCamera; }
164 const TGLCamera * GetCamera() const { return fCamera; }
166 // void SetViewer (TGLViewerBase* v) { fViewer = v; }
170 // Draw LOD, style, clip, rnr-pass
171 Short_t ViewerLOD() const { return fViewerLOD; }
172 void SetViewerLOD(Short_t LOD) { fViewerLOD = LOD; }
173 Short_t SceneLOD() const { return fSceneLOD; }
174 void SetSceneLOD(Short_t LOD) { fSceneLOD = LOD; }
175 Short_t CombiLOD() const { return fCombiLOD; }
176 void SetCombiLOD(Short_t LOD) { fCombiLOD = LOD; }
177 Short_t ShapeLOD() const { return fShapeLOD; }
178 void SetShapeLOD(Short_t LOD) { fShapeLOD = LOD; }
182 Short_t ViewerStyle() const { return fViewerStyle; }
184 Short_t SceneStyle() const { return fSceneStyle; }
185 void SetSceneStyle(Short_t sty) { fSceneStyle = sty; }
196 TGLClip* ViewerClip() const { return fViewerClip; }
198 TGLClip* SceneClip() const { return fSceneClip; }
200 TGLClip* Clip() const { return fClip; }
201 void SetClip(TGLClip *p) { fClip = p; }
202 Bool_t HasClip() const { return fClip != nullptr; }
204 Short_t DrawPass() const { return fDrawPass; }
205 void SetDrawPass(Short_t dpass) { fDrawPass = dpass; }
206 Bool_t IsDrawPassFilled() const;
209 // Render time-out
212 void StartStopwatch();
213 void StopStopwatch();
217 // Highlight / Selection state during rendering
218 Bool_t Highlight() const { return fHighlight; }
219 void SetHighlight(Bool_t hil) { fHighlight = hil; }
222 Bool_t Selection() const { return fSelection; }
225 void SetSecSelection(Bool_t secSel) { fSecSelection = secSel; }
226 // Highlight / selection parameters
232 // Selection setup / end
233 void BeginSelection(Int_t x, Int_t y, Int_t r=3);
234 void EndSelection (Int_t glResult);
236 void PushColorSet();
238 void PopColorSet();
242 void ColorOrForeground(Color_t col);
251 void OpenDLCapture();
252 void CloseDLCapture();
257 void RegisterFont(Int_t size, Int_t file, Int_t mode, TGLFont& out);
258 void RegisterFont(Int_t size, const char* name, Int_t mode, TGLFont& out);
260 void RegisterFontNoScale(Int_t size, const char* name, Int_t mode, TGLFont& out);
261 void ReleaseFont(TGLFont& font);
263 GLUquadric* GetGluQuadric();
265 // Picture grabbing
266 void SetGrabImage(Bool_t gi) { fGrabImage = gi; }
267 Bool_t GetGrabImage() const { return fGrabImage; }
269 // Matrix manipulation helpers
271 void ProjectionMatrixPop();
273 ClassDef(TGLRnrCtx, 0); // Collection of objects and data passes along all rendering calls.
#define c(i)
Definition RSha256.hxx:101
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
short Color_t
Definition RtypesCore.h:92
unsigned char UChar_t
Definition RtypesCore.h:38
float Float_t
Definition RtypesCore.h:57
short Short_t
Definition RtypesCore.h:39
#define ClassDef(name, id)
Definition Rtypes.h:337
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t style
char name[80]
Definition TGX11.cxx:110
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition TGLCamera.h:44
Abstract clipping shape - derives from TGLPhysicalShape Adds clip mode (inside/outside) and pure virt...
Definition TGLClip.h:32
Class encapsulating a set of colors used throughout standard rendering.
Definition TGLUtil.h:836
Identifier of a shared GL-context.
Definition TGLContext.h:81
A wrapper class for FTFont.
Viewport (pixel base) 2D rectangle class.
Definition TGLUtil.h:422
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition TGLRnrCtx.h:41
Float_t fViewerOLLineW
Definition TGLRnrCtx.h:109
void SetRenderScale(Float_t s)
Definition TGLRnrCtx.h:245
void SetSceneInfo(TGLSceneInfo *si)
Definition TGLRnrCtx.h:168
void SetSceneOLLineW(Float_t w)
Definition TGLRnrCtx.h:194
void SetViewerLOD(Short_t LOD)
Definition TGLRnrCtx.h:172
TGLColorSet * ChangeBaseColorSet(TGLColorSet *set)
Change the default/bottom color-set.
Bool_t fSecSelection
Definition TGLRnrCtx.h:127
TGLViewerBase * fViewer
Definition TGLRnrCtx.h:94
std::list< TGLColorSet * > lpTGLColorSet_t
Definition TGLRnrCtx.h:91
void SetRenderTimeOut(Double_t tout)
Definition TGLRnrCtx.h:211
Float_t ShapePixSize() const
Definition TGLRnrCtx.h:179
void SetShapeLOD(Short_t LOD)
Definition TGLRnrCtx.h:178
void BeginSelection(Int_t x, Int_t y, Int_t r=3)
Setup context for running selection.
Definition TGLRnrCtx.h:81
@ kIfNoOpaques
Definition TGLRnrCtx.h:82
Bool_t IsDLCaptureOpen() const
Definition TGLRnrCtx.h:250
UChar_t * fGrabbedImage
Definition TGLRnrCtx.h:147
TGLSceneInfo * fSceneInfo
Definition TGLRnrCtx.h:96
TGLCamera * fCamera
Definition TGLRnrCtx.h:95
TGLClip * fSceneClip
Definition TGLRnrCtx.h:113
void PopColorSet()
Pops the top-most color-set.
Int_t fPickRadius
Definition TGLRnrCtx.h:129
Short_t SelectTransparents() const
Definition TGLRnrCtx.h:227
Float_t fSceneWFLineW
Definition TGLRnrCtx.h:108
Float_t GetRenderScale() const
Definition TGLRnrCtx.h:244
TGLRect * fPickRectangle
Definition TGLRnrCtx.h:130
TGLClip * fClip
Definition TGLRnrCtx.h:114
Bool_t fGrabImage
Definition TGLRnrCtx.h:145
Float_t fSceneOLLineW
Definition TGLRnrCtx.h:110
Short_t SceneStyle() const
Definition TGLRnrCtx.h:184
Int_t GetPickRadius()
Return pick radius. If selection is not active it returns 0.
TGLViewerBase * GetViewer()
Definition TGLRnrCtx.h:154
Float_t ViewerWFLineW() const
Definition TGLRnrCtx.h:187
Short_t fShapeLOD
Definition TGLRnrCtx.h:101
void SetSecSelection(Bool_t secSel)
Definition TGLRnrCtx.h:225
Float_t SceneOLLineW() const
Definition TGLRnrCtx.h:193
UInt_t GetEventKeySym() const
Definition TGLRnrCtx.h:247
void SetSceneClip(TGLClip *p)
Definition TGLRnrCtx.h:199
TGLColorSet * GetBaseColorSet()
Returns the current base color-set.
GLUquadric * fQuadric
Current GL context identity.
Definition TGLRnrCtx.h:142
TGLSelectBuffer * GetSelectBuffer() const
Definition TGLRnrCtx.h:231
void ReleaseFont(TGLFont &font)
Release font in the GL rendering context.
void SetViewerOLLineW(Float_t w)
Definition TGLRnrCtx.h:192
void SetViewerWFLineW(Float_t w)
Definition TGLRnrCtx.h:188
void SetShapePixSize(Float_t ps)
Definition TGLRnrCtx.h:180
void SetGLCtxIdentity(TGLContextIdentity *cid)
Definition TGLRnrCtx.h:255
const TGLCamera * GetCamera() const
Definition TGLRnrCtx.h:164
Double_t RenderTimeOut() const
Definition TGLRnrCtx.h:210
TGLRnrCtx & operator=(const TGLRnrCtx &)=delete
void SetGrabImage(Bool_t gi)
Definition TGLRnrCtx.h:266
TGLSceneBase * GetScene()
Return current scene (based on scene-info data).
void SetSceneLOD(Short_t LOD)
Definition TGLRnrCtx.h:174
void PushColorSet()
Create copy of current color-set on the top of the stack.
TGLStopwatch fStopwatch
Definition TGLRnrCtx.h:118
TGLRect * GetPickRectangle()
Return current pick rectangle.
Short_t ViewerStyle() const
Definition TGLRnrCtx.h:182
Bool_t SecSelection() const
Definition TGLRnrCtx.h:224
GLUquadric * GetGluQuadric()
Initialize fQuadric.
void SetHighlightOutline(Bool_t ho)
Definition TGLRnrCtx.h:221
void RegisterFontNoScale(Int_t size, Int_t file, Int_t mode, TGLFont &out)
Get font in the GL rendering context.
Definition TGLRnrCtx.h:71
@ kSSLImpliedHighlighted
Definition TGLRnrCtx.h:76
@ kSSLSelected
Definition TGLRnrCtx.h:73
@ kSSLNotSelected
Definition TGLRnrCtx.h:72
@ kSSLImpliedSelected
Definition TGLRnrCtx.h:74
@ kSSLHighlighted
Definition TGLRnrCtx.h:75
Bool_t fHighlight
Definition TGLRnrCtx.h:124
void CloseDLCapture()
End display list capture.
lpTGLColorSet_t * fColorSetStack
Definition TGLRnrCtx.h:133
Short_t SceneLOD() const
Definition TGLRnrCtx.h:173
Bool_t IsDrawPassFilled() const
Returns true if current render-pass uses filled polygon style.
Short_t fSceneLOD
Definition TGLRnrCtx.h:99
Bool_t HasClip() const
Definition TGLRnrCtx.h:202
void SetClip(TGLClip *p)
Definition TGLRnrCtx.h:201
TGLSceneBase & RefScene()
Return current scene (based on scene-info data).
TGLColorSet & ColorSet()
Return reference to current color-set (top of the stack).
Bool_t HighlightOutline() const
Definition TGLRnrCtx.h:220
Bool_t IsStopwatchRunning() const
Definition TGLRnrCtx.h:214
Bool_t fHighlightOutline
Definition TGLRnrCtx.h:125
void SetSceneWFLineW(Float_t w)
Definition TGLRnrCtx.h:190
TGLSceneInfo & RefSceneInfo()
Definition TGLRnrCtx.h:159
TGLClip * ViewerClip() const
Definition TGLRnrCtx.h:196
TGLCamera & RefCamera()
Definition TGLRnrCtx.h:157
Bool_t fHasTimedOut
Definition TGLRnrCtx.h:121
virtual ~TGLRnrCtx()
Bool_t GetGrabImage() const
Definition TGLRnrCtx.h:267
void StartStopwatch()
Start the stopwatch.
Int_t fGrabBuffer
Definition TGLRnrCtx.h:146
void RegisterFont(Int_t size, Int_t file, Int_t mode, TGLFont &out)
Get font in the GL rendering context.
void StopStopwatch()
Stop the stopwatch.
Float_t fViewerWFLineW
Definition TGLRnrCtx.h:107
Double_t fRenderTimeOut
Definition TGLRnrCtx.h:119
void EndSelection(Int_t glResult)
End selection.
Float_t fShapePixSize
Definition TGLRnrCtx.h:102
Short_t ViewerLOD() const
Definition TGLRnrCtx.h:171
void SetSceneStyle(Short_t sty)
Definition TGLRnrCtx.h:185
Bool_t fSelection
Definition TGLRnrCtx.h:126
void SetSelectTransparents(Short_t st)
Definition TGLRnrCtx.h:228
Bool_t fDLCaptureOpen
Definition TGLRnrCtx.h:139
UInt_t fEventKeySym
Definition TGLRnrCtx.h:136
void SetViewerStyle(Short_t sty)
Definition TGLRnrCtx.h:183
void ProjectionMatrixPushIdentity()
Float_t ViewerOLLineW() const
Definition TGLRnrCtx.h:191
TGLViewerBase & RefViewer()
Definition TGLRnrCtx.h:155
Short_t fSelectTransparents
Definition TGLRnrCtx.h:128
void SetViewerClip(TGLClip *p)
Definition TGLRnrCtx.h:197
Short_t fDrawPass
Definition TGLRnrCtx.h:116
Bool_t IsDrawPassOutlineLine() const
Definition TGLRnrCtx.h:207
Bool_t HasStopwatchTimedOut()
Check if the stopwatch went beyond the render time limit.
TGLRnrCtx(const TGLRnrCtx &)=delete
void ColorOrForeground(Color_t col)
Set col if it is different from background, otherwise use current foreground color.
void SetCamera(TGLCamera *c)
Definition TGLRnrCtx.h:167
TGLClip * SceneClip() const
Definition TGLRnrCtx.h:198
void SetDrawPass(Short_t dpass)
Definition TGLRnrCtx.h:205
TGLClip * fViewerClip
Definition TGLRnrCtx.h:112
void SetCombiLOD(Short_t LOD)
Definition TGLRnrCtx.h:176
TGLSelectBuffer * fSelectBuffer
Definition TGLRnrCtx.h:131
void ProjectionMatrixPop()
Bool_t Highlight() const
Definition TGLRnrCtx.h:218
Float_t SceneWFLineW() const
Definition TGLRnrCtx.h:189
TGLContextIdentity * fGLCtxIdentity
DL-capture currently open.
Definition TGLRnrCtx.h:140
Short_t fCombiLOD
Definition TGLRnrCtx.h:100
TGLCamera * GetCamera()
Definition TGLRnrCtx.h:156
const TGLCamera & RefCamera() const
Definition TGLRnrCtx.h:163
Short_t DrawPass() const
Definition TGLRnrCtx.h:204
static const char * StyleName(Short_t style)
Return string describing the style.
void OpenDLCapture()
Start display-list capture.
Bool_t fIsRunning
Definition TGLRnrCtx.h:120
TGLClip * Clip() const
Definition TGLRnrCtx.h:200
void SetEventKeySym(UInt_t k)
Definition TGLRnrCtx.h:248
TGLSceneInfo * GetSceneInfo()
Definition TGLRnrCtx.h:158
Short_t fSceneStyle
Definition TGLRnrCtx.h:105
@ kPassOutlineFill
Definition TGLRnrCtx.h:56
@ kPassWireFrame
Definition TGLRnrCtx.h:58
@ kPassOutlineLine
Definition TGLRnrCtx.h:57
Float_t fRenderScale
Definition TGLRnrCtx.h:134
Bool_t Selection() const
Definition TGLRnrCtx.h:222
Short_t fViewerStyle
Definition TGLRnrCtx.h:104
Short_t fViewerLOD
Definition TGLRnrCtx.h:98
void SetSelection(Bool_t sel)
Definition TGLRnrCtx.h:223
Short_t ShapeLOD() const
Definition TGLRnrCtx.h:177
@ kStyleUndef
Definition TGLRnrCtx.h:45
void SetHighlight(Bool_t hil)
Definition TGLRnrCtx.h:219
TGLContextIdentity * GetGLCtxIdentity() const
Definition TGLRnrCtx.h:254
Short_t CombiLOD() const
Definition TGLRnrCtx.h:175
Scene base-class – provides basic interface expected by the TGLViewer or its sub-classes:
Base class for extended scene context.
Encapsulates OpenGL select buffer.
Stopwatch object for timing GL work.
Base class for GL viewers.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17