Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGLPlot3D.cxx
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Matevz Tadel 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, 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#include "TGLPlot3D.h"
13
14#include "TH3.h"
15#include "TH3GL.h"
16#include "TH2.h"
17#include "TH2GL.h"
18#include "TF2.h"
19#include "TF2GL.h"
20#include "TGLParametric.h"
21#include "TPolyMarker3D.h"
23
24#include "TVirtualPad.h"
25
26/** \class TGLPlot3D
27\ingroup opengl
28Description of TGLPlot3D
29*/
30
31
32////////////////////////////////////////////////////////////////////////////////
33/// Constructor.
34
35TGLPlot3D::TGLPlot3D() : TGLObject(), fPlotPainter(nullptr)
36{
37 fDLCache = kFALSE; // Disable display list.
38}
39
40////////////////////////////////////////////////////////////////////////////////
41/// Destructor.
42
47
48////////////////////////////////////////////////////////////////////////////////
49/// Set painter object and destroy the old one.
50
56
57////////////////////////////////////////////////////////////////////////////////
58/// Instantiate the correct plot-painter for given object.
59/// Protected method.
60
62{
63 if (obj->InheritsFrom(TH3::Class()))
64 {
65 return new TH3GL();
66 }
67 else if (obj->InheritsFrom(TH2::Class()))
68 {
69 return new TH2GL();
70 }
71 else if (obj->InheritsFrom(TF2::Class()))
72 {
73 return new TF2GL();
74 }
76 {
77 return new TGLParametricEquationGL();
78 }
79
80 return nullptr;
81}
82
83////////////////////////////////////////////////////////////////////////////////
84/// Create GL plot for specified TH3 and polymarker.
85
87{
88 TGLPlot3D* log = new TH3GL(th3, pm);
89 log->SetBBox();
90
91 return log;
92}
93
94////////////////////////////////////////////////////////////////////////////////
95/// Create GL plot for specified object and options.
96/// Which axes are logarithmic is determined from a pad.
97
99{
100 TGLPlot3D* log = InstantiatePlot(obj);
101
102 if (log)
103 {
104 log->fCoord.SetXLog(pad->GetLogx());
105 log->fCoord.SetYLog(pad->GetLogy());
106 log->fCoord.SetZLog(pad->GetLogz());
107 log->SetModel(obj, opt);
108 log->SetBBox();
109 }
110
111 return log;
112}
113
114////////////////////////////////////////////////////////////////////////////////
115/// Create GL plot for specified object and options.
116/// Which axes are logarithmic is determined from explicit arguments.
117
119{
120 TGLPlot3D* log = InstantiatePlot(obj);
121
122 if (log)
123 {
124 log->fCoord.SetXLog(logx);
125 log->fCoord.SetYLog(logy);
126 log->fCoord.SetZLog(logz);
127 log->SetModel(obj, opt);
128 log->SetBBox();
129 }
130
131 return log;
132}
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
winID h TVirtualViewer3D TVirtualGLPainter p
GL renderer for TF2.
Definition TF2GL.h:22
static TClass * Class()
Bool_t fDLCache
display-list validity bit-field
Base-class for direct OpenGL renderers.
Definition TGLObject.h:22
GL-renderer wrapper for TGLParametricEquation.
static TClass * Class()
Description of TGLPlot3D.
Definition TGLPlot3D.h:23
TGLPlot3D()
Constructor.
Definition TGLPlot3D.cxx:35
static TGLPlot3D * CreatePlot(TH3 *h, TPolyMarker3D *pm)
Create GL plot for specified TH3 and polymarker.
Definition TGLPlot3D.cxx:86
TGLPlotPainter * fPlotPainter
Definition TGLPlot3D.h:29
static TGLPlot3D * InstantiatePlot(TObject *obj)
Instantiate the correct plot-painter for given object.
Definition TGLPlot3D.cxx:61
void SetPainter(TGLPlotPainter *p)
Set painter object and destroy the old one.
Definition TGLPlot3D.cxx:51
~TGLPlot3D() override
Destructor.
Definition TGLPlot3D.cxx:43
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms,...
Rendering of TH2 and derived classes.
Definition TH2GL.h:24
static TClass * Class()
OpenGL renderer class for TH3.
Definition TH3GL.h:27
The 3-D histogram classes derived from the 1-D histogram classes.
Definition TH3.h:40
static TClass * Class()
Mother of all ROOT objects.
Definition TObject.h:41
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:543
A 3D polymarker.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
auto * th3
Definition textalign.C:22