MeVisLab Toolbox Reference
macOpenGL.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 MAC_OPEN_GL_H
14 #define MAC_OPEN_GL_H
15 
17 
18 #if defined(__APPLE__)
19 
21 #include <OpenGL/CGLTypes.h>
22 
23 namespace macos {
24 
27  {
28  public:
29 
31  typedef CGLContextObj GLCtx;
32 
34  static GLCtx create();
35 
37  static void destroy(GLCtx &ctx);
38 
40  static void activate(GLCtx &ctx);
41 
43  static GLCtx current();
44  };
45 
46 }
47 
49 #define MACX__CREATE_AND_ACTIVATE_GLCONTEXT \
50 macos::GLContext::GLCtx __pCtx = macos::GLContext::current(); \
51 macos::GLContext::GLCtx __nCtx = macos::GLContext::create(); \
52 macos::GLContext::activate(__nCtx);
53 
55 #define MACX__DESTROY_GLCONTEXT_AND_ACTIVATE_PREVIOUS \
56 macos::GLContext::activate(__pCtx); \
57 macos::GLContext::destroy(__nCtx);
58 
59 #endif // __APPLE__
60 #endif // __macOpenGL_H
OpenGL context management.
Definition: macOpenGL.h:27
CGLContextObj GLCtx
OpenGL context structure.
Definition: macOpenGL.h:31
static void activate(GLCtx &ctx)
Make given context current.
static GLCtx create()
Returns new context or 0 in case of an error.
static void destroy(GLCtx &ctx)
destroys given context
static GLCtx current()
Return currently active context.
#define OSXSUPPORT_PUBLIC_API
Symbol visibility macros.
AppleScript support.