00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SO_GL_EXTENSION_H_
00025 #define _SO_GL_EXTENSION_H_
00026
00027 #include <Inventor/SbBasic.h>
00028 #include <Inventor/SbString.h>
00029 #include <Inventor/STL/list>
00030 #include <Inventor/threads/SbThreadSpinlock.h>
00031
00032 class SoGLWindow;
00033 class SbPList;
00034
00035 #if defined (_WIN32)
00036
00037 typedef int (WINAPI * PFNWGLCHOOSEPIXELFORMATPROC) (HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd);
00038 typedef int (WINAPI * PFNWGLDESCRIBEPIXELFORMATPROC) (HDC hdc, int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd);
00039 typedef int (WINAPI * PFNWGLSETPIXELFORMATPROC) (HDC hDC, int pf, const PIXELFORMATDESCRIPTOR* pfd);
00040 typedef int (WINAPI * PFNWGLSWAPBUFFERSPROC) (HDC hdc);
00041
00042 #define wglChoosePixelFormat SoGLExtension::m_wglChoosePixelFormat
00043 #define wglSetPixelFormat SoGLExtension::m_wglSetPixelFormat
00044 #define wglDescribePixelFormat SoGLExtension::m_wglDescribePixelFormat
00045 #define wglSwapBuffers SoGLExtension::m_wglSwapBuffers
00046
00047 #endif // _WIN32
00048
00049 #ifdef _MSC_VER
00050 #pragma warning( push )
00051 #pragma warning(disable:4251)
00052 #endif
00053
00668 class SoGLExtension {
00669
00670 public:
00674 static SbBool isAvailable( const char* extension );
00675
00679 static SbBool isAvailable( const SbString& extension );
00680
00689 static void disableExtension(const SbString& extension);
00690
00691 private:
00698 static int getExtID(const char *str);
00699
00701 static SbBool extSupported(int contextID, int ext);
00702
00703 private:
00708 static SbBool initClass();
00709
00713 static void exitClass();
00714
00718 static SbBool isInitialized();
00719
00720 #if defined(_WIN32)
00721 static PFNWGLCHOOSEPIXELFORMATPROC m_wglChoosePixelFormat;
00722 static PFNWGLSETPIXELFORMATPROC m_wglSetPixelFormat;
00723 static PFNWGLDESCRIBEPIXELFORMATPROC m_wglDescribePixelFormat;
00724 static PFNWGLSWAPBUFFERSPROC m_wglSwapBuffers;
00725 #endif // _WIN32
00726
00732 static SbBool hasFullFloat32TextureSupport();
00733
00734 private:
00736 static SoGLWindow* createAndEnableFakeContext();
00737
00738 static std::list<char*> s_disabledList;
00739 static SbBool s_initialized;
00740
00742 static SbThreadSpinlock s_extensionListMutex;
00743 static SbPList* s_extensionList;
00744
00745 static int s_checkContext;
00746 };
00747
00748 #ifdef _MSC_VER
00749 #pragma warning( pop )
00750 #endif
00751
00752 #endif // _SO_GL_EXTENSION_H_
00753
00754
00755