]> git.mxchange.org Git - simgear.git/commitdiff
MSVC fixes
authorehofman <ehofman>
Fri, 28 Jan 2005 09:32:57 +0000 (09:32 +0000)
committerehofman <ehofman>
Fri, 28 Jan 2005 09:32:57 +0000 (09:32 +0000)
simgear/screen/RenderTexture.cpp
simgear/screen/RenderTexture.h
simgear/screen/extensions.hxx

index 364f5ef726221bd5d0362275b7ea85531396c54f..bb49f308c17c0378552e67568ca088a5c461e541 100644 (file)
 /*
  * Changelog:
  *
- * Jan. 2005, Removed GLEW dependencies, Erik Hofman
+ * Jan. 2005, Removed GLEW dependencies, Erik Hofman, Fred Bouvier
  */
 
+#ifdef HAVE_CONFIG_H
+#  include <simgear_config.h>
+#endif
+
+#ifdef HAVE_WINDOWS_H
+#  include <windows.h>
+#endif
 
 #include <simgear/compiler.h>
-#include <simgear/screen/RenderTexture.h>
 #include <simgear/screen/extensions.hxx>
+#include <simgear/screen/RenderTexture.h>
 
 #include <stdio.h>
 #include <stdlib.h>
 
 using namespace std;
 
+#ifdef _WIN32
+static bool fctPtrInited = false;
+/* WGL_ARB_pixel_format */
+static wglChoosePixelFormatARBProc wglChoosePixelFormatARBPtr = 0;
+static wglGetPixelFormatAttribivARBProc wglGetPixelFormatAttribivARBPtr = 0;
+/* WGL_ARB_pbuffer */
+static wglCreatePbufferARBProc wglCreatePbufferARBPtr = 0;
+static wglGetPbufferDCARBProc wglGetPbufferDCARBPtr = 0;
+static wglQueryPbufferARBProc wglQueryPbufferARBPtr = 0;
+static wglReleasePbufferDCARBProc wglReleasePbufferDCARBPtr = 0;
+static wglDestroyPbufferARBProc wglDestroyPbufferARBPtr = 0;
+/* WGL_ARB_render_texture */
+static wglBindTexImageARBProc wglBindTexImageARBPtr = 0;
+static wglReleaseTexImageARBProc wglReleaseTexImageARBPtr = 0;
+#endif
+
 //---------------------------------------------------------------------------
 // Function      : RenderTexture::RenderTexture
 // Description  : 
@@ -296,7 +319,7 @@ bool RenderTexture::Initialize(int width, int height,
     }
     else 
     {
-        if (!wglChoosePixelFormatARB(hdc, &_pixelFormatAttribs[0], NULL, 
+        if (!wglChoosePixelFormatARBPtr(hdc, &_pixelFormatAttribs[0], NULL, 
                                      1, &iFormat, &iNumFormats))
         {
             fprintf(stderr, 
@@ -315,7 +338,7 @@ bool RenderTexture::Initialize(int width, int height,
     }
     
     // Create the p-buffer.    
-    _hPBuffer = wglCreatePbufferARB(hdc, iFormat, _iWidth, _iHeight, 
+    _hPBuffer = wglCreatePbufferARBPtr(hdc, iFormat, _iWidth, _iHeight, 
                                     &_pbufferAttribs[0]);
     if (!_hPBuffer)
     {
@@ -326,7 +349,7 @@ bool RenderTexture::Initialize(int width, int height,
     }
     
     // Get the device context.
-    _hDC = wglGetPbufferDCARB( _hPBuffer);
+    _hDC = wglGetPbufferDCARBPtr( _hPBuffer);
     if ( !_hDC )
     {
         fprintf(stderr, 
@@ -368,8 +391,8 @@ bool RenderTexture::Initialize(int width, int height,
     }
     
     // Determine the actual width and height we were able to create.
-    wglQueryPbufferARB( _hPBuffer, WGL_PBUFFER_WIDTH_ARB, &_iWidth );
-    wglQueryPbufferARB( _hPBuffer, WGL_PBUFFER_HEIGHT_ARB, &_iHeight );
+    wglQueryPbufferARBPtr( _hPBuffer, WGL_PBUFFER_WIDTH_ARB, &_iWidth );
+    wglQueryPbufferARBPtr( _hPBuffer, WGL_PBUFFER_HEIGHT_ARB, &_iHeight );
     
     _bInitialized = true;
     
@@ -378,31 +401,31 @@ bool RenderTexture::Initialize(int width, int height,
     //int bits[6];
     int value;
     _iNumColorBits[0] = 
-        (wglGetPixelFormatAttribivARB(_hDC, iFormat, 0, 1, &attrib, &value)) 
+        (wglGetPixelFormatAttribivARBPtr(_hDC, iFormat, 0, 1, &attrib, &value)) 
         ? value : 0;
     attrib = WGL_GREEN_BITS_ARB;
     _iNumColorBits[1] = 
-        (wglGetPixelFormatAttribivARB(_hDC, iFormat, 0, 1, &attrib, &value)) 
+        (wglGetPixelFormatAttribivARBPtr(_hDC, iFormat, 0, 1, &attrib, &value)) 
         ? value : 0;
     attrib = WGL_BLUE_BITS_ARB;
     _iNumColorBits[2] = 
-        (wglGetPixelFormatAttribivARB(_hDC, iFormat, 0, 1, &attrib, &value)) 
+        (wglGetPixelFormatAttribivARBPtr(_hDC, iFormat, 0, 1, &attrib, &value)) 
         ? value : 0;
     attrib = WGL_ALPHA_BITS_ARB;
     _iNumColorBits[3] = 
-        (wglGetPixelFormatAttribivARB(_hDC, iFormat, 0, 1, &attrib, &value)) 
+        (wglGetPixelFormatAttribivARBPtr(_hDC, iFormat, 0, 1, &attrib, &value)) 
         ? value : 0; 
     attrib = WGL_DEPTH_BITS_ARB;
     _iNumDepthBits = 
-        (wglGetPixelFormatAttribivARB(_hDC, iFormat, 0, 1, &attrib, &value)) 
+        (wglGetPixelFormatAttribivARBPtr(_hDC, iFormat, 0, 1, &attrib, &value)) 
         ? value : 0; 
     attrib = WGL_STENCIL_BITS_ARB;
     _iNumStencilBits = 
-        (wglGetPixelFormatAttribivARB(_hDC, iFormat, 0, 1, &attrib, &value)) 
+        (wglGetPixelFormatAttribivARBPtr(_hDC, iFormat, 0, 1, &attrib, &value)) 
         ? value : 0; 
     attrib = WGL_DOUBLE_BUFFER_ARB;
     _bDoubleBuffered = 
-        (wglGetPixelFormatAttribivARB(_hDC, iFormat, 0, 1, &attrib, &value)) 
+        (wglGetPixelFormatAttribivARBPtr(_hDC, iFormat, 0, 1, &attrib, &value)) 
         ? (value?true:false) : false; 
     
 #if defined(_DEBUG) | defined(DEBUG)
@@ -567,8 +590,8 @@ bool RenderTexture::_Invalidate()
             wglMakeCurrent(0,0);
         if (!_bCopyContext) 
             wglDeleteContext( _hGLContext);
-        wglReleasePbufferDCARB( _hPBuffer, _hDC);
-        wglDestroyPbufferARB( _hPBuffer );
+        wglReleasePbufferDCARBPtr( _hPBuffer, _hDC);
+        wglDestroyPbufferARBPtr( _hPBuffer );
         _hPBuffer = 0;
         return true;
     }
@@ -706,8 +729,8 @@ bool RenderTexture::Resize(int iWidth, int iHeight)
             wglMakeCurrent(0,0);
         if (!_bCopyContext) 
             wglDeleteContext( _hGLContext);
-        wglReleasePbufferDCARB( _hPBuffer, _hDC);
-        wglDestroyPbufferARB( _hPBuffer );
+        wglReleasePbufferDCARBPtr( _hPBuffer, _hDC);
+        wglDestroyPbufferARBPtr( _hPBuffer );
         _hPBuffer = 0;
         return true;
     }
@@ -934,7 +957,7 @@ bool RenderTexture::BindBuffer( int iBuffer )
         if (RT_RENDER_TO_TEXTURE == _eUpdateMode && _bIsTexture &&
             (!_bIsBufferBound || _iCurrentBoundBuffer != iBuffer))
         {
-            if (FALSE == wglBindTexImageARB(_hPBuffer, iBuffer))
+            if (FALSE == wglBindTexImageARBPtr(_hPBuffer, iBuffer))
             {
                 //  WVB: WGL API considers binding twice to the same buffer
                 //  to be an error.  But we don't want to 
@@ -966,7 +989,7 @@ bool RenderTexture::_BindDepthBuffer() const
         RT_RENDER_TO_TEXTURE == _eUpdateMode)
     {
         glBindTexture(_iTextureTarget, _iDepthTextureID);
-        if (FALSE == wglBindTexImageARB(_hPBuffer, WGL_DEPTH_COMPONENT_NV))
+        if (FALSE == wglBindTexImageARBPtr(_hPBuffer, WGL_DEPTH_COMPONENT_NV))
         {
             _wglGetLastError();
             return false;
@@ -1622,6 +1645,28 @@ vector<int> RenderTexture::_ParseBitVector(string bitVector)
 bool RenderTexture::_VerifyExtensions()
 {
 #ifdef _WIN32
+    if ( !fctPtrInited )
+    {
+        fctPtrInited = true;
+        if ( SGIsOpenGLExtensionSupported("WGL_ARB_pixel_format" ) )
+        {
+            wglChoosePixelFormatARBPtr = (wglChoosePixelFormatARBProc)SGLookupFunction("wglChoosePixelFormatARB");
+            wglGetPixelFormatAttribivARBPtr = (wglGetPixelFormatAttribivARBProc)SGLookupFunction("wglGetPixelFormatAttribivARB");
+        }
+        if ( SGIsOpenGLExtensionSupported("WGL_ARB_pbuffer" ) )
+        {
+            wglCreatePbufferARBPtr = (wglCreatePbufferARBProc)SGLookupFunction("wglCreatePbufferARB");
+            wglGetPbufferDCARBPtr = (wglGetPbufferDCARBProc)SGLookupFunction("wglGetPbufferDCARB");
+            wglQueryPbufferARBPtr = (wglQueryPbufferARBProc)SGLookupFunction("wglQueryPbufferARB");
+            wglReleasePbufferDCARBPtr = (wglReleasePbufferDCARBProc)SGLookupFunction("wglReleasePbufferDCARB");
+            wglDestroyPbufferARBPtr = (wglDestroyPbufferARBProc)SGLookupFunction("wglDestroyPbufferARB");
+        }
+        if ( SGIsOpenGLExtensionSupported("WGL_ARB_render_texture" ) )
+        {
+            wglBindTexImageARBPtr = (wglBindTexImageARBProc)SGLookupFunction("wglBindTexImageARB");
+            wglReleaseTexImageARBPtr = (wglReleaseTexImageARBProc)SGLookupFunction("wglReleaseTexImageARB");
+        }
+    }
     if (!WGL_ARB_pbuffer)
     {
         PrintExtensionError("WGL_ARB_pbuffer");
@@ -1944,7 +1989,7 @@ bool RenderTexture::_ReleaseBoundBuffers()
         // release the pbuffer from the render texture object
         if (0 != _iCurrentBoundBuffer && _bIsBufferBound)
         {
-            if (FALSE == wglReleaseTexImageARB(_hPBuffer, _iCurrentBoundBuffer))
+            if (FALSE == wglReleaseTexImageARBPtr(_hPBuffer, _iCurrentBoundBuffer))
             {
                 _wglGetLastError();
                 return false;
@@ -1958,7 +2003,7 @@ bool RenderTexture::_ReleaseBoundBuffers()
         glBindTexture(_iTextureTarget, _iDepthTextureID);
         
         // release the pbuffer from the render texture object
-        if (FALSE == wglReleaseTexImageARB(_hPBuffer, WGL_DEPTH_COMPONENT_NV))
+        if (FALSE == wglReleaseTexImageARBPtr(_hPBuffer, WGL_DEPTH_COMPONENT_NV))
         {
             _wglGetLastError();
             return false;
index b5e7b89fced9319ca0c45bd0437eb2e2dc528d3f..ad90bd314e9bf97525f302303c36f273c5042a77 100644 (file)
 #include <simgear/compiler.h>
 
 #ifndef _WIN32
-#include <X11/Xlib.h>
+#  include <X11/Xlib.h>
 #endif
 #include SG_GL_H
-#include SG_GLX_H
+#ifndef _WIN32
+#  include SG_GLX_H
+#endif
 
 #include <string>
 #include <vector>
index 5aa4c8c4ec0342b7fcb160bee3332894632a56e1..4cad70f176b50f15a56e5ba86a814281612b790a 100644 (file)
@@ -261,6 +261,9 @@ typedef void (APIENTRY * glClientActiveTextureProc)(GLenum texture);
 #define GL_SAMPLE_COVERAGE_VALUE_ARB                           0x80AA
 #define GL_SAMPLE_COVERAGE_INVERT_ARB                          0x80AB
 #define GL_MULTISAMPLE_BIT_ARB                                 0x20000000
+#define WGL_SAMPLE_BUFFERS_ARB                                 0x2041
+#define WGL_SAMPLES_ARB                                                0x2042
+
 #endif
 
 
@@ -271,127 +274,127 @@ typedef void (APIENTRY * glClientActiveTextureProc)(GLenum texture);
 /*
  * ARB_pbuffer
  */
-#ifndef GL_ARB_pbuffer
-#define GL_ARB_pbuffer 1
-#define GL_DRAW_TO_PBUFFER_ARB                                 0x202D
-#define GL_MAX_PBUFFER_PIXELS_ARB                              0x202E
-#define GL_MAX_PBUFFER_WIDTH_ARB                               0x202F
-#define GL_MAX_PBUFFER_HEIGHT_ARB                              0x2030
-#define GL_PBUFFER_LARGEST_ARB                                 0x2033
-#define GL_PBUFFER_WIDTH_ARB                                   0x2034
-#define GL_PBUFFER_HEIGHT_ARB                                  0x2035
-#define GL_PBUFFER_LOST_ARB                                    0x2036
+#ifndef WGL_ARB_pbuffer
+#define WGL_ARB_pbuffer 1
+#define WGL_DRAW_TO_PBUFFER_ARB                                        0x202D
+#define WGL_MAX_PBUFFER_PIXELS_ARB                             0x202E
+#define WGL_MAX_PBUFFER_WIDTH_ARB                              0x202F
+#define WGL_MAX_PBUFFER_HEIGHT_ARB                             0x2030
+#define WGL_PBUFFER_LARGEST_ARB                                        0x2033
+#define WGL_PBUFFER_WIDTH_ARB                                  0x2034
+#define WGL_PBUFFER_HEIGHT_ARB                                 0x2035
+#define WGL_PBUFFER_LOST_ARB                                   0x2036
 DECLARE_HANDLE(HPBUFFERARB);
-typedef HPBUFFERARB (APIENTRY * wglCreatePbufferARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
-typedef HDC (APIENTRY * wglGetPbufferDCARBPROC) (HPBUFFERARB hPbuffer);
-typedef int (APIENTRY * wglReleasePbufferDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
-typedef BOOL (APIENTRY * wglDestroyPbufferARBPROC) (HPBUFFERARB hPbuffer);
-typedef BOOL (APIENTRY * wglQueryPbufferARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
+typedef HPBUFFERARB (APIENTRY * wglCreatePbufferARBProc) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+typedef HDC (APIENTRY * wglGetPbufferDCARBProc) (HPBUFFERARB hPbuffer);
+typedef int (APIENTRY * wglReleasePbufferDCARBProc) (HPBUFFERARB hPbuffer, HDC hDC);
+typedef BOOL (APIENTRY * wglDestroyPbufferARBProc) (HPBUFFERARB hPbuffer);
+typedef BOOL (APIENTRY * wglQueryPbufferARBProc) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
 #endif
 
 
 /*
  * ARB_pixel_format
  */
-#ifndef GL_ARB_pixel_format
-#define GL_ARB_pixel_format 1
-#define GL_NUMBER_PIXEL_FORMATS_ARB                            0x2000
-#define GL_DRAW_TO_WINDOW_ARB                                  0x2001
-#define GL_DRAW_TO_BITMAP_ARB                                  0x2002
-#define GL_ACCELERATION_ARB                                    0x2003
-#define GL_NEED_PALETTE_ARB                                    0x2004
-#define GL_NEED_SYSTEM_PALETTE_ARB                             0x2005
-#define GL_SWAP_LAYER_BUFFERS_ARB                              0x2006
-#define GL_SWAP_METHOD_ARB                                     0x2007
-#define GL_NUMBER_OVERLAYS_ARB                                 0x2008
-#define GL_NUMBER_UNDERLAYS_ARB                                        0x2009
-#define GL_TRANSPARENT_ARB                                     0x200A
-#define GL_SHARE_DEPTH_ARB                                     0x200C
-#define GL_SHARE_STENCIL_ARB                                   0x200D
-#define GL_SHARE_ACCUM_ARB                                     0x200E
-#define GL_SUPPORT_GDI_ARB                                     0x200F
-#define GL_SUPPORT_OPENGL_ARB                                  0x2010
-#define GL_DOUBLE_BUFFER_ARB                                   0x2011
-#define GL_STEREO_ARB                                          0x2012
-#define GL_PIXEL_TYPE_ARB                                      0x2013
-#define GL_COLOR_BITS_ARB                                      0x2014
-#define GL_RED_BITS_ARB                                                0x2015
-#define GL_RED_SHIFT_ARB                                       0x2016
-#define GL_GREEN_BITS_ARB                                      0x2017
-#define GL_GREEN_SHIFT_ARB                                     0x2018
-#define GL_BLUE_BITS_ARB                                       0x2019
-#define GL_BLUE_SHIFT_ARB                                      0x201A
-#define GL_ALPHA_BITS_ARB                                      0x201B
-#define GL_ALPHA_SHIFT_ARB                                     0x201C
-#define GL_ACCUM_BITS_ARB                                      0x201D
-#define GL_ACCUM_RED_BITS_ARB                                  0x201E
-#define GL_ACCUM_GREEN_BITS_ARB                                        0x201F
-#define GL_ACCUM_BLUE_BITS_ARB                                 0x2020
-#define GL_ACCUM_ALPHA_BITS_ARB                                        0x2021
-#define GL_DEPTH_BITS_ARB                                      0x2022
-#define GL_STENCIL_BITS_ARB                                    0x2023
-#define GL_AUX_BUFFERS_ARB                                     0x2024
-#define GL_NO_ACCELERATION_ARB                                 0x2025
-#define GL_GENERIC_ACCELERATION_ARB                            0x2026
-#define GL_FULL_ACCELERATION_ARB                               0x2027
-#define GL_SWAP_EXCHANGE_ARB                                   0x2028
-#define GL_SWAP_COPY_ARB                                       0x2029
-#define GL_SWAP_UNDEFINED_ARB                                  0x202A
-#define GL_TYPE_RGBA_ARB                                       0x202B
-#define GL_TYPE_COLORINDEX_ARB                                 0x202C
-#define GL_TRANSPARENT_RED_VALUE_ARB                           0x2037
-#define GL_TRANSPARENT_GREEN_VALUE_ARB                         0x2038
-#define GL_TRANSPARENT_BLUE_VALUE_ARB                          0x2039
-#define GL_TRANSPARENT_ALPHA_VALUE_ARB                         0x203A
-#define GL_TRANSPARENT_INDEX_VALUE_ARB                         0x203B
-typedef BOOL (APIENTRY * wglGetPixelFormatAttribivARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
-typedef BOOL (APIENTRY * wglGetPixelFormatAttribfvARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
-typedef BOOL (APIENTRY * wglChoosePixelFormatARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#ifndef WGL_ARB_pixel_format
+#define WGL_ARB_pixel_format 1
+#define WGL_NUMBER_PIXEL_FORMATS_ARB                           0x2000
+#define WGL_DRAW_TO_WINDOW_ARB                                 0x2001
+#define WGL_DRAW_TO_BITMAP_ARB                                 0x2002
+#define WGL_ACCELERATION_ARB                                   0x2003
+#define WGL_NEED_PALETTE_ARB                                   0x2004
+#define WGL_NEED_SYSTEM_PALETTE_ARB                            0x2005
+#define WGL_SWAP_LAYER_BUFFERS_ARB                             0x2006
+#define WGL_SWAP_METHOD_ARB                                    0x2007
+#define WGL_NUMBER_OVERLAYS_ARB                                        0x2008
+#define WGL_NUMBER_UNDERLAYS_ARB                               0x2009
+#define WGL_TRANSPARENT_ARB                                    0x200A
+#define WGL_SHARE_DEPTH_ARB                                    0x200C
+#define WGL_SHARE_STENCIL_ARB                                  0x200D
+#define WGL_SHARE_ACCUM_ARB                                    0x200E
+#define WGL_SUPPORT_GDI_ARB                                    0x200F
+#define WGL_SUPPORT_OPENGL_ARB                                 0x2010
+#define WGL_DOUBLE_BUFFER_ARB                                  0x2011
+#define WGL_STEREO_ARB                                         0x2012
+#define WGL_PIXEL_TYPE_ARB                                     0x2013
+#define WGL_COLOR_BITS_ARB                                     0x2014
+#define WGL_RED_BITS_ARB                                       0x2015
+#define WGL_RED_SHIFT_ARB                                      0x2016
+#define WGL_GREEN_BITS_ARB                                     0x2017
+#define WGL_GREEN_SHIFT_ARB                                    0x2018
+#define WGL_BLUE_BITS_ARB                                      0x2019
+#define WGL_BLUE_SHIFT_ARB                                     0x201A
+#define WGL_ALPHA_BITS_ARB                                     0x201B
+#define WGL_ALPHA_SHIFT_ARB                                    0x201C
+#define WGL_ACCUM_BITS_ARB                                     0x201D
+#define WGL_ACCUM_RED_BITS_ARB                                 0x201E
+#define WGL_ACCUM_GREEN_BITS_ARB                               0x201F
+#define WGL_ACCUM_BLUE_BITS_ARB                                        0x2020
+#define WGL_ACCUM_ALPHA_BITS_ARB                               0x2021
+#define WGL_DEPTH_BITS_ARB                                     0x2022
+#define WGL_STENCIL_BITS_ARB                                   0x2023
+#define WGL_AUX_BUFFERS_ARB                                    0x2024
+#define WGL_NO_ACCELERATION_ARB                                        0x2025
+#define WGL_GENERIC_ACCELERATION_ARB                           0x2026
+#define WGL_FULL_ACCELERATION_ARB                              0x2027
+#define WGL_SWAP_EXCHANGE_ARB                                  0x2028
+#define WGL_SWAP_COPY_ARB                                      0x2029
+#define WGL_SWAP_UNDEFINED_ARB                                 0x202A
+#define WGL_TYPE_RGBA_ARB                                      0x202B
+#define WGL_TYPE_COLORINDEX_ARB                                        0x202C
+#define WGL_TRANSPARENT_RED_VALUE_ARB                          0x2037
+#define WGL_TRANSPARENT_GREEN_VALUE_ARB                                0x2038
+#define WGL_TRANSPARENT_BLUE_VALUE_ARB                         0x2039
+#define WGL_TRANSPARENT_ALPHA_VALUE_ARB                                0x203A
+#define WGL_TRANSPARENT_INDEX_VALUE_ARB                                0x203B
+typedef BOOL (APIENTRY * wglGetPixelFormatAttribivARBProc) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
+typedef BOOL (APIENTRY * wglGetPixelFormatAttribfvARBProc) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
+typedef BOOL (APIENTRY * wglChoosePixelFormatARBProc) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
 #endif
 
 /*
  * ARB_render_texture
  */
-#ifndef GL_ARB_render_texture
-#define GL_ARB_render_texture 1
-
-#define GL_BIND_TO_TEXTURE_RGB_ARB                             0x2070
-#define GL_BIND_TO_TEXTURE_RGBA_ARB                            0x2071
-#define GL_TEXTURE_FORMAT_ARB                                  0x2072
-#define GL_TEXTURE_TARGET_ARB                                  0x2073
-#define GL_MIPMAP_TEXTURE_ARB                                  0x2074
-#define GL_TEXTURE_RGB_ARB                                     0x2075
-#define GL_TEXTURE_RGBA_ARB                                    0x2076
-#define GL_NO_TEXTURE_ARB                                      0x2077
-#define GL_TEXTURE_CUBE_MAP_ARB                                        0x2078
-#define GL_TEXTURE_1D_ARB                                      0x2079
-#define GL_TEXTURE_2D_ARB                                      0x207A
-#define GL_NO_TEXTURE_ARB                                      0x2077
-#define GL_MIPMAP_LEVEL_ARB                                    0x207B
-#define GL_CUBE_MAP_FACE_ARB                                   0x207C
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB                     0x207D
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB                     0x207E
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB                     0x207F
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB                     0x2080
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB                     0x2081
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB                     0x2082
-#define GL_FRONT_LEFT_ARB                                      0x2083
-#define GL_FRONT_RIGHT_ARB                                     0x2084
-#define GL_BACK_LEFT_ARB                                       0x2085
-#define GL_BACK_RIGHT_ARB                                      0x2086
-#define GL_AUX0_ARB                                            0x2087
-#define GL_AUX1_ARB                                            0x2088
-#define GL_AUX2_ARB                                            0x2089
-#define GL_AUX3_ARB                                            0x208A
-#define GL_AUX4_ARB                                            0x208B
-#define GL_AUX5_ARB                                            0x208C
-#define GL_AUX6_ARB                                            0x208D
-#define GL_AUX7_ARB                                            0x208E
-#define GL_AUX8_ARB                                            0x208F
-#define GL_AUX9_ARB                                            0x2090
-typedef BOOL (APIENTRY * wglBindTexImageARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
-typedef BOOL (APIENTRY * wglReleaseTexImageARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
-typedef BOOL (APIENTRY * wglSetPbufferAttribARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
+#ifndef WGL_ARB_render_texture
+#define WGL_ARB_render_texture 1
+
+#define WGL_BIND_TO_TEXTURE_RGB_ARB                            0x2070
+#define WGL_BIND_TO_TEXTURE_RGBA_ARB                           0x2071
+#define WGL_TEXTURE_FORMAT_ARB                                 0x2072
+#define WGL_TEXTURE_TARGET_ARB                                 0x2073
+#define WGL_MIPMAP_TEXTURE_ARB                                 0x2074
+#define WGL_TEXTURE_RGB_ARB                                    0x2075
+#define WGL_TEXTURE_RGBA_ARB                                   0x2076
+#define WGL_NO_TEXTURE_ARB                                     0x2077
+#define WGL_TEXTURE_CUBE_MAP_ARB                               0x2078
+#define WGL_TEXTURE_1D_ARB                                     0x2079
+#define WGL_TEXTURE_2D_ARB                                     0x207A
+#define WGL_NO_TEXTURE_ARB                                     0x2077
+#define WGL_MIPMAP_LEVEL_ARB                                   0x207B
+#define WGL_CUBE_MAP_FACE_ARB                                  0x207C
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB                    0x207D
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB                    0x207E
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB                    0x207F
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB                    0x2080
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB                    0x2081
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB                    0x2082
+#define WGL_FRONT_LEFT_ARB                                     0x2083
+#define WGL_FRONT_RIGHT_ARB                                    0x2084
+#define WGL_BACK_LEFT_ARB                                      0x2085
+#define WGL_BACK_RIGHT_ARB                                     0x2086
+#define WGL_AUX0_ARB                                           0x2087
+#define WGL_AUX1_ARB                                           0x2088
+#define WGL_AUX2_ARB                                           0x2089
+#define WGL_AUX3_ARB                                           0x208A
+#define WGL_AUX4_ARB                                           0x208B
+#define WGL_AUX5_ARB                                           0x208C
+#define WGL_AUX6_ARB                                           0x208D
+#define WGL_AUX7_ARB                                           0x208E
+#define WGL_AUX8_ARB                                           0x208F
+#define WGL_AUX9_ARB                                           0x2090
+typedef BOOL (APIENTRY * wglBindTexImageARBProc) (HPBUFFERARB hPbuffer, int iBuffer);
+typedef BOOL (APIENTRY * wglReleaseTexImageARBProc) (HPBUFFERARB hPbuffer, int iBuffer);
+typedef BOOL (APIENTRY * wglSetPbufferAttribARBProc) (HPBUFFERARB hPbuffer, const int *piAttribList);
 #endif
 
 #endif /* WIN32 */
@@ -411,18 +414,29 @@ typedef BOOL (APIENTRY * wglSetPbufferAttribARBPROC) (HPBUFFERARB hPbuffer, cons
 #define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV                       0x84F8
 #endif
 
+/*
+ * WGL_NV_texture_rectangle
+ */
+
+#ifndef WGL_NV_texture_rectangle
+#define WGL_NV_texture_rectangle 1
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV                   0x20A0
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV                  0x20A1
+#define WGL_TEXTURE_RECTANGLE_NV                               0x20A2
+#endif
+
 /*
  * NV_render_depth_texture
  */
 
-#ifndef GL_NV_render_depth_texture
-#define GL_NV_render_depth_texture 1
-#define GL_NO_TEXTURE_ARBxi                                    0x2077
-#define GL_BIND_TO_TEXTURE_DEPTH_NV                            0x20A3
-#define GL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV                  0x20A4
-#define GL_DEPTH_TEXTURE_FORMAT_NV                             0x20A5
-#define GL_TEXTURE_DEPTH_COMPONENT_NV                          0x20A6
-#define GL_DEPTH_COMPONENT_NV                                  0x20A7
+#ifndef WGL_NV_render_depth_texture
+#define WGL_NV_render_depth_texture 1
+#define WGL_NO_TEXTURE_ARB                                     0x2077
+#define WGL_BIND_TO_TEXTURE_DEPTH_NV                           0x20A3
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV                 0x20A4
+#define WGL_DEPTH_TEXTURE_FORMAT_NV                            0x20A5
+#define WGL_TEXTURE_DEPTH_COMPONENT_NV                         0x20A6
+#define WGL_DEPTH_COMPONENT_NV                                 0x20A7
 #endif
 
 /*
@@ -458,6 +472,18 @@ typedef BOOL (APIENTRY * wglSetPbufferAttribARBPROC) (HPBUFFERARB hPbuffer, cons
 #define GLX_TEXTURE_FLOAT_RGB_NV                               0x20B7
 #define GLX_TEXTURE_FLOAT_RGBA_NV                              0x20B8
 #endif
+#ifndef WGL_NV_float_buffer
+#define WGL_NV_float_buffer 1
+#define WGL_FLOAT_COMPONENTS_NV                                        0x20B0
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV               0x20B1
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV              0x20B2
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV             0x20B3
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV            0x20B4
+#define WGL_TEXTURE_FLOAT_R_NV                                 0x20B5
+#define WGL_TEXTURE_FLOAT_RG_NV                                        0x20B6
+#define WGL_TEXTURE_FLOAT_RGB_NV                               0x20B7
+#define WGL_TEXTURE_FLOAT_RGBA_NV                              0x20B8
+#endif
 
 
 /* ATI specific extension */
@@ -465,9 +491,9 @@ typedef BOOL (APIENTRY * wglSetPbufferAttribARBPROC) (HPBUFFERARB hPbuffer, cons
 /*
  * ATI_pixel_format_float
  */
-#ifndef GL_ATI_pixel_format_float
-#define GL_ATI_pixel_format_float 1
-#define GL_TYPE_RGBA_FLOAT_ATI                                 0x21A0
+#ifndef WGL_ATI_pixel_format_float
+#define WGL_ATI_pixel_format_float 1
+#define WGL_TYPE_RGBA_FLOAT_ATI                                        0x21A0
 #define GL_RGBA_FLOAT_MODE_ATI                                 0x8820
 #define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI                     0x8835
 #endif