Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 "TGlobal.h"
18
19
21
22TGLManager * (*gPtr2GLManager)() = nullptr;
23
24namespace {
25static struct AddPseudoGlobals {
26AddPseudoGlobals() {
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
36TGLManager::TGLManager() : TNamed("gGLManager", "")
37{
38}
39
40////////////////////////////////////////////////////////////////////////////////
41/// Return the global GL Manager.
42
44{
45 static TGLManager *instance = nullptr;
46
47 if(gPtr2GLManager) {
48 instance = gPtr2GLManager();
49 }
50
51 return instance;
52}
53
55
56
58
#define ClassImp(name)
Definition Rtypes.h:377
R__EXTERN TGLManager *(* gPtr2GLManager)()
Definition TVirtualGL.h:161
static TGLManager *& Instance()
Return the global GL Manager.
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