MeVisLab Toolbox Reference
mlGLContext.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef ML_GLCONTEXT_H
14 #define ML_GLCONTEXT_H
15 
17 
18 #include "mlOpenGLSystem.h"
19 #include "mlOpenGL.h"
20 
22 
23 class GLContextStackPrivate;
24 
28 {
29  public:
35  public:
38  }
41  }
42  };
43 
47  public:
50  }
53  }
54  };
55 
57  static void pushCurrentContext();
58 
60  static void popCurrentContext();
61 
68 
72 
73  private:
74  static void init();
75 
76  static GLContextStackPrivate* _private;
77 };
78 
80 
82 #define CREATE_AND_ACTIVATE_GLCONTEXT \
83  ML_OPENGL_NAMESPACE::GLContextStack::createTemporaryContextAndActivate();
84 
86 #define DESTROY_GLCONTEXT_AND_ACTIVATE_PREVIOUS \
87  ML_OPENGL_NAMESPACE::GLContextStack::destroyTemporaryContextAndActivatePreviousContext();
88 
89 #endif // __mlGLContext_H
Stores the current GL context and re-activates it when the scope object is deleted.
Definition: mlGLContext.h:46
Creates a temporary OpenGL context and destroys it when the object goes out of scope.
Definition: mlGLContext.h:34
Manages a stack of GL contexts and their correct activation (NOTE: This is only accessible in the GUI...
Definition: mlGLContext.h:28
static void pushCurrentContext()
pushes the current OpenGL context (detected via platform specific state) to the stack
static void popCurrentContext()
pops the previously pushed context and activates it
static void createTemporaryContextAndActivate()
Pushes the current context and creates and activates a new temporary OpenGL context which may be used...
static void destroyTemporaryContextAndActivatePreviousContext()
Destroys the temporary context created via createTemporaryContextAndActivate() and pops/activates the...
#define ML_OPENGL_END_NAMESPACE
Closes the namespace for all ML stuff after the usage of ML_UTILS_START_NAMESPACE.
#define ML_OPENGL_START_NAMESPACE
Macro to put all following stuff into the namespace ML_NAMESPACE to avoid collisions with symbols of ...
#define MLOPENGL_EXPORT
void init()
Initializes the ML, the runtime type system, the memory manager, fields, static buffers,...