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
32
33////////////////////////////////////////////////////////////////////////////////
34/// Constructor.
35
36TGLPlot3D::TGLPlot3D() : TGLObject(), fPlotPainter(nullptr)
37{
38 fDLCache = kFALSE; // Disable display list.
39}
40
41////////////////////////////////////////////////////////////////////////////////
42/// Destructor.
43
45{
46 delete fPlotPainter;
47}
48
49////////////////////////////////////////////////////////////////////////////////
50/// Set painter object and destroy the old one.
51
53{
54 delete fPlotPainter;
56}
57
58////////////////////////////////////////////////////////////////////////////////
59/// Instantiate the correct plot-painter for given object.
60/// Protected method.
61
63{
64 if (obj->InheritsFrom(TH3::Class()))
65 {
66 return new TH3GL();
67 }
68 else if (obj->InheritsFrom(TH2::Class()))
69 {
70 return new TH2GL();
71 }
72 else if (obj->InheritsFrom(TF2::Class()))
73 {
74 return new TF2GL();
75 }
77 {
78 return new TGLParametricEquationGL();
79 }
80
81 return nullptr;
82}
83
84////////////////////////////////////////////////////////////////////////////////
85/// Create GL plot for specified TH3 and polymarker.
86
88{
89 TGLPlot3D* log = new TH3GL(th3, pm);
90 log->SetBBox();
91
92 return log;
93}
94
95////////////////////////////////////////////////////////////////////////////////
96/// Create GL plot for specified object and options.
97/// Which axes are logarithmic is determined from a pad.
98
100{
101 TGLPlot3D* log = InstantiatePlot(obj);
102
103 if (log)
104 {
105 log->fCoord.SetXLog(pad->GetLogx());
106 log->fCoord.SetYLog(pad->GetLogy());
107 log->fCoord.SetZLog(pad->GetLogz());
108 log->SetModel(obj, opt);
109 log->SetBBox();
110 }
111
112 return log;
113}
114
115////////////////////////////////////////////////////////////////////////////////
116/// Create GL plot for specified object and options.
117/// Which axes are logarithmic is determined from explicit arguments.
118
120{
121 TGLPlot3D* log = InstantiatePlot(obj);
122
123 if (log)
124 {
125 log->fCoord.SetXLog(logx);
126 log->fCoord.SetYLog(logy);
127 log->fCoord.SetZLog(logz);
128 log->SetModel(obj, opt);
129 log->SetBBox();
130 }
131
132 return log;
133}
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
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:36
static TGLPlot3D * CreatePlot(TH3 *h, TPolyMarker3D *pm)
Create GL plot for specified TH3 and polymarker.
Definition TGLPlot3D.cxx:87
TGLPlotPainter * fPlotPainter
Definition TGLPlot3D.h:29
static TGLPlot3D * InstantiatePlot(TObject *obj)
Instantiate the correct plot-painter for given object.
Definition TGLPlot3D.cxx:62
void SetPainter(TGLPlotPainter *p)
Set painter object and destroy the old one.
Definition TGLPlot3D.cxx:52
~TGLPlot3D() override
Destructor.
Definition TGLPlot3D.cxx:44
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:31
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:525
A 3D polymarker.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
virtual Int_t GetLogz() const =0
virtual Int_t GetLogy() const =0
virtual Int_t GetLogx() const =0
auto * th3
Definition textalign.C:22