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
00670 class SoGLExtension {
00671
00672 public:
00676 static SbBool isAvailable( const char* extension );
00677
00681 static SbBool isAvailable( const SbString& extension );
00682
00691 static void disableExtension(const SbString& extension);
00692
00693 private:
00700 static int getExtID(const char *str);
00701
00703 static SbBool extSupported(int contextID, int ext);
00704
00705 private:
00710 static SbBool initClass();
00711
00715 static void exitClass();
00716
00720 static SbBool isInitialized();
00721
00722 #if defined(_WIN32)
00723 static PFNWGLCHOOSEPIXELFORMATPROC m_wglChoosePixelFormat;
00724 static PFNWGLSETPIXELFORMATPROC m_wglSetPixelFormat;
00725 static PFNWGLDESCRIBEPIXELFORMATPROC m_wglDescribePixelFormat;
00726 static PFNWGLSWAPBUFFERSPROC m_wglSwapBuffers;
00727 #endif // _WIN32
00728
00734 static SbBool hasFullFloat32TextureSupport();
00735
00736 private:
00738 static SoGLWindow* createAndEnableFakeContext();
00739
00740 static std::list<char*> s_disabledList;
00741 static SbBool s_initialized;
00742
00744 static SbThreadSpinlock s_extensionListMutex;
00745 static SbPList* s_extensionList;
00746
00747 static int s_checkContext;
00748 };
00749
00750 #ifdef _MSC_VER
00751 #pragma warning( pop )
00752 #endif
00753
00754 #endif // _SO_GL_EXTENSION_H_
00755
00756
00757