Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoGLGlew.h
1#if !defined(SOGLGLEW_H)
2#define SOGLGLEW_H 1
3
4#include <Inventor/sys/port.h>
5#include <Inventor/SbBase.h>
6#include <Inventor/SoInventorGLEWLibName.h>
7
8#if defined(_WIN32)
9# ifndef InventorGLEW_EXPORTS
10# ifndef OIV_DISABLE_AUTOLINK
11# pragma comment(lib,__INVENTORGLEWLIB)
12# endif
13# endif
14#endif
15
16#ifdef InventorGLEW_EXPORTS
17# define INVENTORGLEW_API VC_DLL_EXPORT
18#else
19# define INVENTORGLEW_API VC_DLL_IMPORT
20#endif
21
22#if defined(OIV_HEADLESS)
23#define glewGetContextNative eglewGetContext
24#elif defined(_WIN32)
25#define glewGetContextNative wglewGetContext
26#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
27#define glewGetContextNative glxewGetContext
28#else
29#define glewGetContextNative glewGetContextMac
30#endif
31
33namespace SoEGLEW
34{
35 struct EGLEWContextStruct;
36}
37
38namespace SoGLXEW
39{
40 struct GLXEWContextStruct;
41}
45{
46public:
47
48#if defined(OIV_HEADLESS)
49 typedef struct SoEGLEW::EGLEWContextStruct GlewContextNative;
50#elif defined(_WIN32)
51 typedef struct WGLEWContextStruct GlewContextNative;
52#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
53 typedef struct SoGLXEW::GLXEWContextStruct GlewContextNative;
54#else
55 typedef struct GLEWContextStruct GlewContextNative;
56#endif
57 SoGLGlew();
58 ~SoGLGlew();
59
60 // GLEWContext associated to this rendering context.
61 struct GLEWContextStruct* m_glewContext;
62 GlewContextNative* m_glewContextNative;
63
64 bool m_glewInit;
65
66 // These methods return a pointer to the GLEWContext associated to this context.
67 struct GLEWContextStruct* glewGetContextIV() const
68 { return m_glewContext; }
69
70 GlewContextNative* glewGetContextNativeIV() const
71 { return m_glewContextNative; }
72
73 bool isGLEWInitialized() { return m_glewInit; }
74
78 void initGLEWContext();
82 bool initGLEW();
83 bool initGLXEW();
84 bool initEGLEW();
85
86 void cleanGLEWContext();
87};
88#endif // SOGLGLEW_H