Logo ROOT   6.08/07
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 "TROOT.h"
18 #include "TGlobal.h"
19 
20 
22 
24 
25 namespace {
26 static struct AddPseudoGlobals {
27 AddPseudoGlobals() {
28  // User "gCling" as synonym for "libCore static initialization has happened".
29  // This code here must not trigger it.
30  TGlobalMappedFunction::Add(new TGlobalMappedFunction("gGLManager", "TVirtualGL*",
32 }
33 } gAddPseudoGlobals;
34 }
35 
36 ////////////////////////////////////////////////////////////////////////////////
37 
38 TGLManager::TGLManager() : TNamed("gGLManager", "")
39 {
40 }
41 
42 ////////////////////////////////////////////////////////////////////////////////
43 /// Return the global GL Manager.
44 
46 {
47  static TGLManager *instance = 0;
48 
49  if(gPtr2GLManager) {
50  instance = gPtr2GLManager();
51  }
52 
53  return instance;
54 }
55 
57 
58 
60 
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
static TGLManager *& Instance()
Return the global GL Manager.
Definition: TVirtualGL.cxx:45
static void Add(TGlobalMappedFunction *gmf)
Definition: TGlobal.cxx:178
#define ClassImp(name)
Definition: Rtypes.h:279
#define gGLManager
Definition: TVirtualGL.h:168
TGLManager *(* gPtr2GLManager)()=0
Definition: TVirtualGL.cxx:23
void *(* GlobalFunc_t)()
Definition: TGlobal.h:56