Logo ROOT  
Reference Guide
TVirtualGL.cxx
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Valery Fine 05/03/97
3 
4 /** \class TVirtualGL
5 
6 The TVirtualGL class is an abstract base class defining the
7 OpenGL interface protocol. All interactions with OpenGL should be
8 done via the global pointer gVirtualGL. If the OpenGL library is
9 available this pointer is pointing to an instance of the TGLKernel
10 class which provides the actual interface to OpenGL. Using this
11 scheme of ABC we can use OpenGL in other parts of the framework
12 without having to link with the OpenGL library in case we don't
13 use the classes using OpenGL.
14 */
15 
16 #include "TVirtualGL.h"
17 #include "TGlobal.h"
18 
19 
21 
22 TGLManager * (*gPtr2GLManager)() = nullptr;
23 
24 namespace {
25 static struct AddPseudoGlobals {
26 AddPseudoGlobals() {
27  // User "gCling" as synonym for "libCore static initialization has happened".
28  // This code here must not trigger it.
29  TGlobalMappedFunction::MakeFunctor("gGLManager", "TVirtualGL*", TGLManager::Instance);
30 }
31 } gAddPseudoGlobals;
32 }
33 
34 ////////////////////////////////////////////////////////////////////////////////
35 
36 TGLManager::TGLManager() : TNamed("gGLManager", "")
37 {
38 }
39 
40 ////////////////////////////////////////////////////////////////////////////////
41 /// Return the global GL Manager.
42 
44 {
45  static TGLManager *instance = nullptr;
46 
47  if(gPtr2GLManager) {
49  }
50 
51  return instance;
52 }
53 
55 
56 
58 
TVirtualGLPainter
Definition: TVirtualGL.h:45
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TGLManager::Instance
static TGLManager *& Instance()
Return the global GL Manager.
Definition: TVirtualGL.cxx:43
TGlobalMappedFunction::MakeFunctor
static void MakeFunctor(const char *name, const char *type, GlobFunc &func)
Definition: TGlobal.h:73
TNamed
Definition: TNamed.h:29
TGlobal.h
TGLManager
Definition: TVirtualGL.h:70
TGLManager::TGLManager
TGLManager()
Definition: TVirtualGL.cxx:36
TGLPaintDevice
Definition: TVirtualGL.h:144
RooFit_internal::instance
static Roo_reg_AGKInteg1D instance
Definition: RooAdaptiveGaussKronrodIntegrator1D.cxx:153
TVirtualGL.h
TVirtualGLManip
Definition: TVirtualGL.h:59
gPtr2GLManager
TGLManager *(* gPtr2GLManager)()
Definition: TVirtualGL.cxx:22