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
6The TVirtualGL class is an abstract base class defining the
7OpenGL interface protocol. All interactions with OpenGL should be
8done via the global pointer gVirtualGL. If the OpenGL library is
9available this pointer is pointing to an instance of the TGLKernel
10class which provides the actual interface to OpenGL. Using this
11scheme of ABC we can use OpenGL in other parts of the framework
12without having to link with the OpenGL library in case we don't
13use the classes using OpenGL.
14*/
15
16#include "TVirtualGL.h"
17#include "TROOT.h"
18#include "TGlobal.h"
19
20
22
23TGLManager * (*gPtr2GLManager)() = nullptr;
24
25namespace {
26static struct AddPseudoGlobals {
27AddPseudoGlobals() {
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
37TGLManager::TGLManager() : TNamed("gGLManager", "")
38{
39}
40
41////////////////////////////////////////////////////////////////////////////////
42/// Return the global GL Manager.
43
45{
46 static TGLManager *instance = nullptr;
47
48 if(gPtr2GLManager) {
50 }
51
52 return instance;
53}
54
56
57
59
#define ClassImp(name)
Definition: Rtypes.h:361
TGLManager *(* gPtr2GLManager)()
Definition: TVirtualGL.cxx:23
static TGLManager *& Instance()
Return the global GL Manager.
Definition: TVirtualGL.cxx:44
static void MakeFunctor(const char *name, const char *type, GlobFunc &func)
Definition: TGlobal.h:73
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
static Roo_reg_AGKInteg1D instance