00001 #if !defined(SOGLGLEW_H)
00002 #define SOGLGLEW_H 1
00003
00004 #include <Inventor/sys/port.h>
00005 #include <Inventor/SbBase.h>
00006 #include <Inventor/SoInventorGLEWLibName.h>
00007
00008 #if defined(_WIN32)
00009 # ifndef InventorGLEW_EXPORTS
00010 # ifndef OIV_DISABLE_AUTOLINK
00011 # pragma comment(lib,__INVENTORGLEWLIB)
00012 # endif
00013 # endif
00014 #endif
00015
00016 #ifdef InventorGLEW_EXPORTS
00017 # define INVENTORGLEW_API VC_DLL_EXPORT
00018 #else
00019 # define INVENTORGLEW_API VC_DLL_IMPORT
00020 #endif
00021
00022 #if defined(OIV_HEADLESS)
00023 #define glewGetContextNative eglewGetContext
00024 #elif defined(_WIN32)
00025 #define glewGetContextNative wglewGetContext
00026 #elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
00027 #define glewGetContextNative glxewGetContext
00028 #else
00029 #define glewGetContextNative glewGetContextMac
00030 #endif
00031
00032 namespace SoEGLEW
00033 {
00034 struct EGLEWContextStruct;
00035 }
00036
00037 namespace SoGLXEW
00038 {
00039 struct GLXEWContextStruct;
00040 }
00041
00042
00043 {
00044 public:
00045
00046 #if defined(OIV_HEADLESS)
00047 typedef struct SoEGLEW::EGLEWContextStruct GlewContextNative;
00048 #elif defined(_WIN32)
00049 typedef struct WGLEWContextStruct GlewContextNative;
00050 #elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
00051 typedef struct SoGLXEW::GLXEWContextStruct GlewContextNative;
00052 #else
00053 typedef struct GLEWContextStruct GlewContextNative;
00054 #endif
00055 SoGLGlew();
00056
00057
00058 struct GLEWContextStruct* m_glewContext;
00059 GlewContextNative* m_glewContextNative;
00060
00061 bool m_glewInit;
00062
00063
00064 struct GLEWContextStruct* glewGetContextIV() const
00065 { return m_glewContext; }
00066
00067 GlewContextNative* glewGetContextNativeIV() const
00068 { return m_glewContextNative; }
00069
00070 bool isGLEWInitialized() { return m_glewInit; }
00071
00075 void initGLEWContext();
00079 bool initGLEW();
00080 bool initGLXEW();
00081 bool initEGLEW();
00082
00083 void cleanGLEWContext();
00084 };
00085 #endif // SOGLGLEW_H
00086