Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
21 ClassImp(TGLManager);
22 
23 TGLManager * (*gPtr2GLManager)() = nullptr;
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::MakeFunctor("gGLManager", "TVirtualGL*", TGLManager::Instance);
31 }
32 } gAddPseudoGlobals;
33 }
34 
35 ////////////////////////////////////////////////////////////////////////////////
36 
37 TGLManager::TGLManager() : TNamed("gGLManager", "")
38 {
39 }
40 
41 ////////////////////////////////////////////////////////////////////////////////
42 /// Return the global GL Manager.
43 
44 TGLManager *&TGLManager::Instance()
45 {
46  static TGLManager *instance = nullptr;
47 
48  if(gPtr2GLManager) {
49  instance = gPtr2GLManager();
50  }
51 
52  return instance;
53 }
54 
55 ClassImp(TVirtualGLPainter);
56 
57 
58 ClassImp(TVirtualGLManip);
59 
60 ClassImp(TGLPaintDevice);