-/* $Id: wgl.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */\r
-\r
-/*\r
-* This library is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU Library General Public\r
-* License as published by the Free Software Foundation; either\r
-* version 2 of the License, or (at your option) any later version.\r
-*\r
-* This library is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
-* Library General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU Library General Public\r
-* License along with this library; if not, write to the Free\r
-* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
-*\r
-*/\r
-\r
-/*\r
-* File name : wgl.c\r
-* WGL stuff. Added by Oleg Letsinsky, ajl@ultersys.ru\r
-* Some things originated from the 3Dfx WGL functions\r
-*/\r
-\r
-#ifdef WIN32\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-#include <windows.h>\r
-\r
-#include <GL/gl.h>\r
-#include <GL/glu.h>\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#include <stdio.h>\r
-#include <tchar.h>\r
-#include "wmesadef.h"\r
-#include "GL/wmesa.h"\r
-#include "types.h"\r
-\r
-#define MAX_MESA_ATTRS 20\r
-\r
-struct __extensions__\r
-{\r
- PROC proc;\r
- char *name;\r
-};\r
-\r
-struct __pixelformat__\r
-{\r
- PIXELFORMATDESCRIPTOR pfd;\r
- GLboolean doubleBuffered;\r
-};\r
-\r
-struct __extensions__ ext[] = {\r
-\r
-#ifdef GL_EXT_polygon_offset\r
- { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" },\r
-#endif\r
- { (PROC)glBlendEquationEXT, "glBlendEquationEXT" },\r
- { (PROC)glBlendColorEXT, "glBlendColorExt" },\r
- { (PROC)glVertexPointerEXT, "glVertexPointerEXT" },\r
- { (PROC)glNormalPointerEXT, "glNormalPointerEXT" },\r
- { (PROC)glColorPointerEXT, "glColorPointerEXT" },\r
- { (PROC)glIndexPointerEXT, "glIndexPointerEXT" },\r
- { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" },\r
- { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" },\r
- { (PROC)glGetPointervEXT, "glGetPointervEXT" },\r
- { (PROC)glArrayElementEXT, "glArrayElementEXT" },\r
- { (PROC)glDrawArraysEXT, "glDrawArrayEXT" },\r
- { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" },\r
- { (PROC)glBindTextureEXT, "glBindTextureEXT" },\r
- { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" },\r
- { (PROC)glGenTexturesEXT, "glGenTexturesEXT" },\r
- { (PROC)glIsTextureEXT, "glIsTextureEXT" },\r
- { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" },\r
- { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" },\r
- { (PROC)glTexImage3DEXT, "glTexImage3DEXT" },\r
- { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" },\r
- { (PROC)glColorTableEXT, "glColorTableEXT" },\r
- { (PROC)glColorSubTableEXT, "glColorSubTableEXT" },\r
- { (PROC)glGetColorTableEXT, "glGetColorTableEXT" },\r
- { (PROC)glGetColorTableParameterfvEXT, "glGetColorTableParameterfvEXT" },\r
- { (PROC)glGetColorTableParameterivEXT, "glGetColorTableParameterivEXT" },\r
- { (PROC)glPointParameterfEXT, "glPointParameterfEXT" },\r
- { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" },\r
- { (PROC)glBlendFuncSeparateINGR, "glBlendFuncSeparateINGR" },\r
- { (PROC)glLockArraysEXT, "glLockArraysEXT" },\r
- { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" }\r
-};\r
-\r
-int qt_ext = sizeof(ext) / sizeof(ext[0]);\r
-\r
-struct __pixelformat__ pix[] =\r
-{\r
- { { sizeof(PIXELFORMATDESCRIPTOR), 1,\r
- PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_GENERIC_FORMAT|PFD_DOUBLEBUFFER|PFD_SWAP_COPY,\r
- PFD_TYPE_RGBA,\r
- 24, 8, 0, 8, 8, 8, 16, 8, 24,\r
- 0, 0, 0, 0, 0, 16, 8, 0, 0, 0, 0, 0, 0 },\r
- GL_TRUE\r
- },\r
- { { sizeof(PIXELFORMATDESCRIPTOR), 1,\r
- PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_GENERIC_FORMAT,\r
- PFD_TYPE_RGBA,\r
- 24, 8, 0, 8, 8, 8, 16, 8, 24,\r
- 0, 0, 0, 0, 0, 16, 8, 0, 0, 0, 0, 0, 0 },\r
- GL_FALSE\r
- },\r
-};\r
-\r
-int qt_pix = sizeof(pix) / sizeof(pix[0]);\r
-\r
-typedef struct {\r
- WMesaContext ctx;\r
- HDC hdc;\r
-} MesaWglCtx;\r
-\r
-#define MESAWGL_CTX_MAX_COUNT 20\r
-\r
-static MesaWglCtx wgl_ctx[MESAWGL_CTX_MAX_COUNT];\r
-\r
-static unsigned ctx_count = 0;\r
-static unsigned ctx_current = -1;\r
-static unsigned curPFD = 0;\r
-\r
-GLAPI BOOL GLWINAPI wglCopyContext(HGLRC hglrcSrc,HGLRC hglrcDst,UINT mask)\r
-{\r
- return(FALSE);\r
-}\r
-\r
-GLAPI HGLRC GLWINAPI wglCreateContext(HDC hdc)\r
-{\r
- HWND hWnd;\r
- int i = 0;\r
- if(!(hWnd = WindowFromDC(hdc)))\r
- {\r
- SetLastError(0);\r
- return(NULL);\r
- }\r
- if (!ctx_count)\r
- {\r
- for(i=0;i<MESAWGL_CTX_MAX_COUNT;i++)\r
- {\r
- wgl_ctx[i].ctx = NULL;\r
- wgl_ctx[i].hdc = NULL;\r
- }\r
- }\r
- for( i = 0; i < MESAWGL_CTX_MAX_COUNT; i++ )\r
- {\r
- if ( wgl_ctx[i].ctx == NULL )\r
- {\r
- wgl_ctx[i].ctx = WMesaCreateContext( hWnd, NULL, GL_TRUE,\r
- pix[curPFD-1].doubleBuffered );\r
- if (wgl_ctx[i].ctx == NULL)\r
- break;\r
- wgl_ctx[i].hdc = hdc;\r
- ctx_count++;\r
- return ((HGLRC)wgl_ctx[i].ctx);\r
- }\r
- }\r
- SetLastError(0);\r
- return(NULL);\r
-}\r
-\r
-GLAPI BOOL GLWINAPI wglDeleteContext(HGLRC hglrc)\r
-{\r
- int i;\r
- for ( i = 0; i < MESAWGL_CTX_MAX_COUNT; i++ )\r
- {\r
- if ( wgl_ctx[i].ctx == (PWMC) hglrc )\r
- {\r
- WMesaMakeCurrent((PWMC) hglrc);\r
- WMesaDestroyContext();\r
- wgl_ctx[i].ctx = NULL;\r
- wgl_ctx[i].hdc = NULL;\r
- ctx_count--;\r
- return(TRUE);\r
- }\r
- }\r
- SetLastError(0);\r
- return(FALSE);\r
-}\r
-\r
-GLAPI HGLRC GLWINAPI wglCreateLayerContext(HDC hdc,int iLayerPlane)\r
-{\r
- SetLastError(0);\r
- return(NULL);\r
-}\r
-\r
-GLAPI HGLRC GLWINAPI wglGetCurrentContext(VOID)\r
-{\r
- if (ctx_current < 0)\r
- return 0;\r
- else\r
- return (HGLRC) wgl_ctx[ctx_current].ctx;\r
-}\r
-\r
-GLAPI HDC GLWINAPI wglGetCurrentDC(VOID)\r
-{\r
- if (ctx_current < 0)\r
- return 0;\r
- else\r
- return wgl_ctx[ctx_current].hdc;\r
-}\r
-\r
-GLAPI BOOL GLWINAPI wglMakeCurrent(HDC hdc,HGLRC hglrc)\r
-{\r
- int i;\r
-\r
- /* new code suggested by Andy Sy */\r
- if (!hdc || !hglrc) {\r
- WMesaMakeCurrent(NULL);\r
- ctx_current = -1;\r
- return TRUE;\r
- }\r
-\r
- for ( i = 0; i < MESAWGL_CTX_MAX_COUNT; i++ )\r
- {\r
- if ( wgl_ctx[i].ctx == (PWMC) hglrc )\r
- {\r
- wgl_ctx[i].hdc = hdc;\r
- WMesaMakeCurrent( (WMesaContext) hglrc );\r
- ctx_current = i;\r
- return TRUE;\r
- }\r
- }\r
- return FALSE;\r
-}\r
-\r
-GLAPI BOOL GLWINAPI wglShareLists(HGLRC hglrc1,HGLRC hglrc2)\r
-{\r
- return(TRUE);\r
-}\r
-\r
+/* $Id: wgl.c,v 1.2 1999/09/19 09:59:20 tjump Exp $ */
+
+/*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Library General Public
+* License as published by the Free Software Foundation; either
+* version 2 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Library General Public License for more details.
+*
+* You should have received a copy of the GNU Library General Public
+* License along with this library; if not, write to the Free
+* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*
+*/
+
+/*
+* File name : wgl.c
+* WGL stuff. Added by Oleg Letsinsky, ajl@ultersys.ru
+* Some things originated from the 3Dfx WGL functions
+*/
+
+#ifdef WIN32
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <windows.h>
+
+#include <GL/gl.h>
+//#include <GL/glu.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <stdio.h>
+#include <tchar.h>
+#include "wmesadef.h"
+#include "GL/wmesa.h"
+#include "types.h"
+
+#define MAX_MESA_ATTRS 20
+
+struct __extensions__
+{
+ PROC proc;
+ char *name;
+};
+
+struct __pixelformat__
+{
+ PIXELFORMATDESCRIPTOR pfd;
+ GLboolean doubleBuffered;
+};
+
+struct __extensions__ ext[] = {
+
+#ifdef GL_EXT_polygon_offset
+ { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" },
+#endif
+ { (PROC)glBlendEquationEXT, "glBlendEquationEXT" },
+ { (PROC)glBlendColorEXT, "glBlendColorExt" },
+ { (PROC)glVertexPointerEXT, "glVertexPointerEXT" },
+ { (PROC)glNormalPointerEXT, "glNormalPointerEXT" },
+ { (PROC)glColorPointerEXT, "glColorPointerEXT" },
+ { (PROC)glIndexPointerEXT, "glIndexPointerEXT" },
+ { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" },
+ { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" },
+ { (PROC)glGetPointervEXT, "glGetPointervEXT" },
+ { (PROC)glArrayElementEXT, "glArrayElementEXT" },
+ { (PROC)glDrawArraysEXT, "glDrawArrayEXT" },
+ { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" },
+ { (PROC)glBindTextureEXT, "glBindTextureEXT" },
+ { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" },
+ { (PROC)glGenTexturesEXT, "glGenTexturesEXT" },
+ { (PROC)glIsTextureEXT, "glIsTextureEXT" },
+ { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" },
+ { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" },
+ { (PROC)glTexImage3DEXT, "glTexImage3DEXT" },
+ { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" },
+ { (PROC)glColorTableEXT, "glColorTableEXT" },
+ { (PROC)glColorSubTableEXT, "glColorSubTableEXT" },
+ { (PROC)glGetColorTableEXT, "glGetColorTableEXT" },
+ { (PROC)glGetColorTableParameterfvEXT, "glGetColorTableParameterfvEXT" },
+ { (PROC)glGetColorTableParameterivEXT, "glGetColorTableParameterivEXT" },
+ { (PROC)glPointParameterfEXT, "glPointParameterfEXT" },
+ { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" },
+ { (PROC)glBlendFuncSeparateINGR, "glBlendFuncSeparateINGR" },
+ { (PROC)glLockArraysEXT, "glLockArraysEXT" },
+ { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" }
+};
+
+int qt_ext = sizeof(ext) / sizeof(ext[0]);
+
+struct __pixelformat__ pix[] =
+{
+ { { sizeof(PIXELFORMATDESCRIPTOR), 1,
+ PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_GENERIC_FORMAT|PFD_DOUBLEBUFFER|PFD_SWAP_COPY,
+ PFD_TYPE_RGBA,
+ 24, 8, 0, 8, 8, 8, 16, 8, 24,
+ 0, 0, 0, 0, 0, 16, 8, 0, 0, 0, 0, 0, 0 },
+ GL_TRUE
+ },
+ { { sizeof(PIXELFORMATDESCRIPTOR), 1,
+ PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_GENERIC_FORMAT,
+ PFD_TYPE_RGBA,
+ 24, 8, 0, 8, 8, 8, 16, 8, 24,
+ 0, 0, 0, 0, 0, 16, 8, 0, 0, 0, 0, 0, 0 },
+ GL_FALSE
+ },
+};
+
+int qt_pix = sizeof(pix) / sizeof(pix[0]);
+
+typedef struct {
+ WMesaContext ctx;
+ HDC hdc;
+} MesaWglCtx;
+
+#define MESAWGL_CTX_MAX_COUNT 20
+
+static MesaWglCtx wgl_ctx[MESAWGL_CTX_MAX_COUNT];
+
+static unsigned ctx_count = 0;
+static unsigned ctx_current = -1;
+static unsigned curPFD = 0;
+
+GLAPI BOOL GLWINAPI wglCopyContext(HGLRC hglrcSrc,HGLRC hglrcDst,UINT mask)
+{
+ return(FALSE);
+}
+
+GLAPI HGLRC GLWINAPI wglCreateContext(HDC hdc)
+{
+ HWND hWnd;
+ int i = 0;
+ if(!(hWnd = WindowFromDC(hdc)))
+ {
+ SetLastError(0);
+ return(NULL);
+ }
+ if (!ctx_count)
+ {
+ for(i=0;i<MESAWGL_CTX_MAX_COUNT;i++)
+ {
+ wgl_ctx[i].ctx = NULL;
+ wgl_ctx[i].hdc = NULL;
+ }
+ }
+ for( i = 0; i < MESAWGL_CTX_MAX_COUNT; i++ )
+ {
+ if ( wgl_ctx[i].ctx == NULL )
+ {
+ wgl_ctx[i].ctx = WMesaCreateContext( hWnd, NULL, GL_TRUE,
+ pix[curPFD-1].doubleBuffered );
+ if (wgl_ctx[i].ctx == NULL)
+ break;
+ wgl_ctx[i].hdc = hdc;
+ ctx_count++;
+ return ((HGLRC)wgl_ctx[i].ctx);
+ }
+ }
+ SetLastError(0);
+ return(NULL);
+}
+
+GLAPI BOOL GLWINAPI wglDeleteContext(HGLRC hglrc)
+{
+ int i;
+ for ( i = 0; i < MESAWGL_CTX_MAX_COUNT; i++ )
+ {
+ if ( wgl_ctx[i].ctx == (PWMC) hglrc )
+ {
+ WMesaMakeCurrent((PWMC) hglrc);
+ WMesaDestroyContext();
+ wgl_ctx[i].ctx = NULL;
+ wgl_ctx[i].hdc = NULL;
+ ctx_count--;
+ return(TRUE);
+ }
+ }
+ SetLastError(0);
+ return(FALSE);
+}
+
+GLAPI HGLRC GLWINAPI wglCreateLayerContext(HDC hdc,int iLayerPlane)
+{
+ SetLastError(0);
+ return(NULL);
+}
+
+GLAPI HGLRC GLWINAPI wglGetCurrentContext(VOID)
+{
+ if (ctx_current < 0)
+ return 0;
+ else
+ return (HGLRC) wgl_ctx[ctx_current].ctx;
+}
+
+GLAPI HDC GLWINAPI wglGetCurrentDC(VOID)
+{
+ if (ctx_current < 0)
+ return 0;
+ else
+ return wgl_ctx[ctx_current].hdc;
+}
+
+GLAPI BOOL GLWINAPI wglMakeCurrent(HDC hdc,HGLRC hglrc)
+{
+ int i;
+
+ /* new code suggested by Andy Sy */
+ if (!hdc || !hglrc) {
+ WMesaMakeCurrent(NULL);
+ ctx_current = -1;
+ return TRUE;
+ }
+
+ for ( i = 0; i < MESAWGL_CTX_MAX_COUNT; i++ )
+ {
+ if ( wgl_ctx[i].ctx == (PWMC) hglrc )
+ {
+ wgl_ctx[i].hdc = hdc;
+ WMesaMakeCurrent( (WMesaContext) hglrc );
+ ctx_current = i;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+GLAPI BOOL GLWINAPI wglShareLists(HGLRC hglrc1,HGLRC hglrc2)
+{
+ return(TRUE);
+}
+
static FIXED FixedFromDouble(double d)
{
return TRUE;
}
-\r
-GLAPI BOOL GLWINAPI wglUseFontBitmapsW(HDC hdc,DWORD first,DWORD count,DWORD listBase)\r
-{\r
- return FALSE;\r
-}\r
-\r
-GLAPI BOOL GLWINAPI wglUseFontOutlinesA(HDC hdc,DWORD first,DWORD count,\r
- DWORD listBase,FLOAT deviation,\r
- FLOAT extrusion,int format,\r
- LPGLYPHMETRICSFLOAT lpgmf)\r
-{\r
- SetLastError(0);\r
- return(FALSE);\r
-}\r
-\r
-GLAPI BOOL GLWINAPI wglUseFontOutlinesW(HDC hdc,DWORD first,DWORD count,\r
- DWORD listBase,FLOAT deviation,\r
- FLOAT extrusion,int format,\r
- LPGLYPHMETRICSFLOAT lpgmf)\r
-{\r
- SetLastError(0);\r
- return(FALSE);\r
-}\r
-\r
-GLAPI BOOL GLWINAPI wglDescribeLayerPlane(HDC hdc,int iPixelFormat,\r
- int iLayerPlane,UINT nBytes,\r
- LPLAYERPLANEDESCRIPTOR plpd)\r
-{\r
- SetLastError(0);\r
- return(FALSE);\r
-}\r
-\r
-GLAPI int GLWINAPI wglSetLayerPaletteEntries(HDC hdc,int iLayerPlane,\r
- int iStart,int cEntries,\r
- CONST COLORREF *pcr)\r
-{\r
- SetLastError(0);\r
- return(0);\r
-}\r
-\r
-GLAPI int GLWINAPI wglGetLayerPaletteEntries(HDC hdc,int iLayerPlane,\r
- int iStart,int cEntries,\r
- COLORREF *pcr)\r
-{\r
- SetLastError(0);\r
- return(0);\r
-}\r
-\r
-GLAPI BOOL GLWINAPI wglRealizeLayerPalette(HDC hdc,int iLayerPlane,BOOL bRealize)\r
-{\r
- SetLastError(0);\r
- return(FALSE);\r
-}\r
-\r
-GLAPI BOOL GLWINAPI wglSwapLayerBuffers(HDC hdc,UINT fuPlanes)\r
-{\r
- if( !hdc )\r
- {\r
- WMesaSwapBuffers();\r
- return(TRUE);\r
- }\r
- SetLastError(0);\r
- return(FALSE);\r
-}\r
-\r
-GLAPI int GLWINAPI wglChoosePixelFormat(HDC hdc,\r
- CONST PIXELFORMATDESCRIPTOR *ppfd)\r
-{\r
- int i,best = -1,bestdelta = 0x7FFFFFFF,delta,qt_valid_pix;\r
-\r
- qt_valid_pix = qt_pix;\r
- if(ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR) || ppfd->nVersion != 1)\r
- {\r
- SetLastError(0);\r
- return(0);\r
- }\r
- for(i = 0;i < qt_valid_pix;i++)\r
- {\r
- delta = 0;\r
- if(\r
- (ppfd->dwFlags & PFD_DRAW_TO_WINDOW) &&\r
- !(pix[i].pfd.dwFlags & PFD_DRAW_TO_WINDOW))\r
- continue;\r
- if(\r
- (ppfd->dwFlags & PFD_DRAW_TO_BITMAP) &&\r
- !(pix[i].pfd.dwFlags & PFD_DRAW_TO_BITMAP))\r
- continue;\r
- if(\r
- (ppfd->dwFlags & PFD_SUPPORT_GDI) &&\r
- !(pix[i].pfd.dwFlags & PFD_SUPPORT_GDI))\r
- continue;\r
- if(\r
- (ppfd->dwFlags & PFD_SUPPORT_OPENGL) &&\r
- !(pix[i].pfd.dwFlags & PFD_SUPPORT_OPENGL))\r
- continue;\r
- if(\r
- !(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE) &&\r
- ((ppfd->dwFlags & PFD_DOUBLEBUFFER) != (pix[i].pfd.dwFlags & PFD_DOUBLEBUFFER)))\r
- continue;\r
- if(\r
- !(ppfd->dwFlags & PFD_STEREO_DONTCARE) &&\r
- ((ppfd->dwFlags & PFD_STEREO) != (pix[i].pfd.dwFlags & PFD_STEREO)))\r
- continue;\r
- if(ppfd->iPixelType != pix[i].pfd.iPixelType)\r
- delta++;\r
- if(delta < bestdelta)\r
- {\r
- best = i + 1;\r
- bestdelta = delta;\r
- if(bestdelta == 0)\r
- break;\r
- }\r
- }\r
- if(best == -1)\r
- {\r
- SetLastError(0);\r
- return(0);\r
- }\r
- return(best);\r
-}\r
-\r
-GLAPI int GLWINAPI wglDescribePixelFormat(HDC hdc,int iPixelFormat,UINT nBytes,\r
- LPPIXELFORMATDESCRIPTOR ppfd)\r
-{\r
- int qt_valid_pix;\r
-\r
- qt_valid_pix = qt_pix;\r
- if(iPixelFormat < 1 || iPixelFormat > qt_valid_pix || nBytes != sizeof(PIXELFORMATDESCRIPTOR))\r
- {\r
- SetLastError(0);\r
- return(0);\r
- }\r
- *ppfd = pix[iPixelFormat - 1].pfd;\r
- return(qt_valid_pix);\r
-}\r
-\r
-/*\r
-* GetProcAddress - return the address of an appropriate extension\r
-*/\r
-GLAPI PROC GLWINAPI wglGetProcAddress(LPCSTR lpszProc)\r
-{\r
- int i;\r
- for(i = 0;i < qt_ext;i++)\r
- if(!strcmp(lpszProc,ext[i].name))\r
- return(ext[i].proc);\r
-\r
- SetLastError(0);\r
- return(NULL);\r
-}\r
-\r
-GLAPI int GLWINAPI wglGetPixelFormat(HDC hdc)\r
-{\r
- if(curPFD == 0)\r
- {\r
- SetLastError(0);\r
- return(0);\r
- }\r
- return(curPFD);\r
-}\r
-\r
-GLAPI BOOL GLWINAPI wglSetPixelFormat(HDC hdc,int iPixelFormat,\r
- PIXELFORMATDESCRIPTOR *ppfd)\r
-{\r
- int qt_valid_pix;\r
-\r
- qt_valid_pix = qt_pix;\r
- if(iPixelFormat < 1 || iPixelFormat > qt_valid_pix || ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR))\r
- {\r
- SetLastError(0);\r
- return(FALSE);\r
- }\r
- curPFD = iPixelFormat;\r
- return(TRUE);\r
-}\r
-\r
-GLAPI BOOL GLWINAPI wglSwapBuffers(HDC hdc)\r
-{\r
- if (ctx_current < 0)\r
- return FALSE;\r
-\r
- if(wgl_ctx[ctx_current].ctx == NULL) {\r
- SetLastError(0);\r
- return(FALSE);\r
- }\r
- WMesaSwapBuffers();\r
- return(TRUE);\r
-}\r
-\r
-#endif /* WIN32 */\r
+
+GLAPI BOOL GLWINAPI wglUseFontBitmapsW(HDC hdc,DWORD first,DWORD count,DWORD listBase)
+{
+ return FALSE;
+}
+
+GLAPI BOOL GLWINAPI wglUseFontOutlinesA(HDC hdc,DWORD first,DWORD count,
+ DWORD listBase,FLOAT deviation,
+ FLOAT extrusion,int format,
+ LPGLYPHMETRICSFLOAT lpgmf)
+{
+ SetLastError(0);
+ return(FALSE);
+}
+
+GLAPI BOOL GLWINAPI wglUseFontOutlinesW(HDC hdc,DWORD first,DWORD count,
+ DWORD listBase,FLOAT deviation,
+ FLOAT extrusion,int format,
+ LPGLYPHMETRICSFLOAT lpgmf)
+{
+ SetLastError(0);
+ return(FALSE);
+}
+
+GLAPI BOOL GLWINAPI wglDescribeLayerPlane(HDC hdc,int iPixelFormat,
+ int iLayerPlane,UINT nBytes,
+ LPLAYERPLANEDESCRIPTOR plpd)
+{
+ SetLastError(0);
+ return(FALSE);
+}
+
+GLAPI int GLWINAPI wglSetLayerPaletteEntries(HDC hdc,int iLayerPlane,
+ int iStart,int cEntries,
+ CONST COLORREF *pcr)
+{
+ SetLastError(0);
+ return(0);
+}
+
+GLAPI int GLWINAPI wglGetLayerPaletteEntries(HDC hdc,int iLayerPlane,
+ int iStart,int cEntries,
+ COLORREF *pcr)
+{
+ SetLastError(0);
+ return(0);
+}
+
+GLAPI BOOL GLWINAPI wglRealizeLayerPalette(HDC hdc,int iLayerPlane,BOOL bRealize)
+{
+ SetLastError(0);
+ return(FALSE);
+}
+
+GLAPI BOOL GLWINAPI wglSwapLayerBuffers(HDC hdc,UINT fuPlanes)
+{
+ if( !hdc )
+ {
+ WMesaSwapBuffers();
+ return(TRUE);
+ }
+ SetLastError(0);
+ return(FALSE);
+}
+
+GLAPI int GLWINAPI wglChoosePixelFormat(HDC hdc,
+ CONST PIXELFORMATDESCRIPTOR *ppfd)
+{
+ int i,best = -1,bestdelta = 0x7FFFFFFF,delta,qt_valid_pix;
+
+ qt_valid_pix = qt_pix;
+ if(ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR) || ppfd->nVersion != 1)
+ {
+ SetLastError(0);
+ return(0);
+ }
+ for(i = 0;i < qt_valid_pix;i++)
+ {
+ delta = 0;
+ if(
+ (ppfd->dwFlags & PFD_DRAW_TO_WINDOW) &&
+ !(pix[i].pfd.dwFlags & PFD_DRAW_TO_WINDOW))
+ continue;
+ if(
+ (ppfd->dwFlags & PFD_DRAW_TO_BITMAP) &&
+ !(pix[i].pfd.dwFlags & PFD_DRAW_TO_BITMAP))
+ continue;
+ if(
+ (ppfd->dwFlags & PFD_SUPPORT_GDI) &&
+ !(pix[i].pfd.dwFlags & PFD_SUPPORT_GDI))
+ continue;
+ if(
+ (ppfd->dwFlags & PFD_SUPPORT_OPENGL) &&
+ !(pix[i].pfd.dwFlags & PFD_SUPPORT_OPENGL))
+ continue;
+ if(
+ !(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE) &&
+ ((ppfd->dwFlags & PFD_DOUBLEBUFFER) != (pix[i].pfd.dwFlags & PFD_DOUBLEBUFFER)))
+ continue;
+ if(
+ !(ppfd->dwFlags & PFD_STEREO_DONTCARE) &&
+ ((ppfd->dwFlags & PFD_STEREO) != (pix[i].pfd.dwFlags & PFD_STEREO)))
+ continue;
+ if(ppfd->iPixelType != pix[i].pfd.iPixelType)
+ delta++;
+ if(delta < bestdelta)
+ {
+ best = i + 1;
+ bestdelta = delta;
+ if(bestdelta == 0)
+ break;
+ }
+ }
+ if(best == -1)
+ {
+ SetLastError(0);
+ return(0);
+ }
+ return(best);
+}
+
+GLAPI int GLWINAPI wglDescribePixelFormat(HDC hdc,int iPixelFormat,UINT nBytes,
+ LPPIXELFORMATDESCRIPTOR ppfd)
+{
+ int qt_valid_pix;
+
+ qt_valid_pix = qt_pix;
+ if(iPixelFormat < 1 || iPixelFormat > qt_valid_pix || nBytes != sizeof(PIXELFORMATDESCRIPTOR))
+ {
+ SetLastError(0);
+ return(0);
+ }
+ *ppfd = pix[iPixelFormat - 1].pfd;
+ return(qt_valid_pix);
+}
+
+/*
+* GetProcAddress - return the address of an appropriate extension
+*/
+GLAPI PROC GLWINAPI wglGetProcAddress(LPCSTR lpszProc)
+{
+ int i;
+ for(i = 0;i < qt_ext;i++)
+ if(!strcmp(lpszProc,ext[i].name))
+ return(ext[i].proc);
+
+ SetLastError(0);
+ return(NULL);
+}
+
+GLAPI int GLWINAPI wglGetPixelFormat(HDC hdc)
+{
+ if(curPFD == 0)
+ {
+ SetLastError(0);
+ return(0);
+ }
+ return(curPFD);
+}
+
+GLAPI BOOL GLWINAPI wglSetPixelFormat(HDC hdc,int iPixelFormat,
+ PIXELFORMATDESCRIPTOR *ppfd)
+{
+ int qt_valid_pix;
+
+ qt_valid_pix = qt_pix;
+ if(iPixelFormat < 1 || iPixelFormat > qt_valid_pix || ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR))
+ {
+ SetLastError(0);
+ return(FALSE);
+ }
+ curPFD = iPixelFormat;
+ return(TRUE);
+}
+
+GLAPI BOOL GLWINAPI wglSwapBuffers(HDC hdc)
+{
+ if (ctx_current < 0)
+ return FALSE;
+
+ if(wgl_ctx[ctx_current].ctx == NULL) {
+ SetLastError(0);
+ return(FALSE);
+ }
+ WMesaSwapBuffers();
+ return(TRUE);
+}
+
+#endif /* WIN32 */