ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

fxwgl.c
Go to the documentation of this file.
00001 /*
00002  * Mesa 3-D graphics library
00003  * Version:  4.0
00004  *
00005  * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
00006  *
00007  * Permission is hereby granted, free of charge, to any person obtaining a
00008  * copy of this software and associated documentation files (the "Software"),
00009  * to deal in the Software without restriction, including without limitation
00010  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011  * and/or sell copies of the Software, and to permit persons to whom the
00012  * Software is furnished to do so, subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice shall be included
00015  * in all copies or substantial portions of the Software.
00016  *
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00018  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00020  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023  */
00024 
00025 /* Authors:
00026  *    David Bucciarelli
00027  *    Brian Paul
00028  *    Keith Whitwell
00029  *    Hiroshi Morii
00030  *    Daniel Borca
00031  */
00032 
00033 /* fxwgl.c - Microsoft wgl functions emulation for
00034  *           3Dfx VooDoo/Mesa interface
00035  */
00036 
00037 
00038 #ifdef _WIN32
00039 
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043 
00044 #include <windows.h>
00045 #define GL_GLEXT_PROTOTYPES
00046 #include "GL/gl.h"
00047 #include "GL/glext.h"
00048 
00049 #ifdef __cplusplus
00050 }
00051 #endif
00052 
00053 #include "GL/fxmesa.h"
00054 #include "glheader.h"
00055 #include "glapi.h"
00056 #include "imports.h"
00057 #include "../../glide/fxdrv.h"
00058 
00059 #define MAX_MESA_ATTRS  20
00060 
00061 #if (_MSC_VER >= 1200)
00062 #pragma warning( push )
00063 #pragma warning( disable : 4273 )
00064 #endif
00065 
00066 struct __extensions__ {
00067    PROC proc;
00068    char *name;
00069 };
00070 
00071 struct __pixelformat__ {
00072    PIXELFORMATDESCRIPTOR pfd;
00073    GLint mesaAttr[MAX_MESA_ATTRS];
00074 };
00075 
00076 WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *);
00077 static GLushort gammaTable[3 * 256];
00078 
00079 struct __pixelformat__ pix[] = {
00080    /* 16bit RGB565 single buffer with depth */
00081    {
00082     {sizeof(PIXELFORMATDESCRIPTOR), 1,
00083      PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL,
00084      PFD_TYPE_RGBA,
00085      16,
00086      5, 0, 6, 5, 5, 11, 0, 0,
00087      0, 0, 0, 0, 0,
00088      16,
00089      0,
00090      0,
00091      PFD_MAIN_PLANE,
00092      0, 0, 0, 0}
00093     ,
00094     {FXMESA_COLORDEPTH, 16,
00095      FXMESA_ALPHA_SIZE, 0,
00096      FXMESA_DEPTH_SIZE, 16,
00097      FXMESA_STENCIL_SIZE, 0,
00098      FXMESA_ACCUM_SIZE, 0,
00099      FXMESA_NONE}
00100    }
00101    ,
00102    /* 16bit RGB565 double buffer with depth */
00103    {
00104     {sizeof(PIXELFORMATDESCRIPTOR), 1,
00105      PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
00106      PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
00107      PFD_TYPE_RGBA,
00108      16,
00109      5, 0, 6, 5, 5, 11, 0, 0,
00110      0, 0, 0, 0, 0,
00111      16,
00112      0,
00113      0,
00114      PFD_MAIN_PLANE,
00115      0, 0, 0, 0}
00116     ,
00117     {FXMESA_COLORDEPTH, 16,
00118      FXMESA_DOUBLEBUFFER,
00119      FXMESA_ALPHA_SIZE, 0,
00120      FXMESA_DEPTH_SIZE, 16,
00121      FXMESA_STENCIL_SIZE, 0,
00122      FXMESA_ACCUM_SIZE, 0,
00123      FXMESA_NONE}
00124    }
00125    ,
00126    /* 16bit ARGB1555 single buffer with depth */
00127    {
00128     {sizeof(PIXELFORMATDESCRIPTOR), 1,
00129      PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL,
00130      PFD_TYPE_RGBA,
00131      16,
00132      5, 0, 5, 5, 5, 10, 1, 15,
00133      0, 0, 0, 0, 0,
00134      16,
00135      0,
00136      0,
00137      PFD_MAIN_PLANE,
00138      0, 0, 0, 0}
00139     ,
00140     {FXMESA_COLORDEPTH, 15,
00141      FXMESA_ALPHA_SIZE, 1,
00142      FXMESA_DEPTH_SIZE, 16,
00143      FXMESA_STENCIL_SIZE, 0,
00144      FXMESA_ACCUM_SIZE, 0,
00145      FXMESA_NONE}
00146    }
00147    ,
00148    /* 16bit ARGB1555 double buffer with depth */
00149    {
00150     {sizeof(PIXELFORMATDESCRIPTOR), 1,
00151      PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
00152      PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
00153      PFD_TYPE_RGBA,
00154      16,
00155      5, 0, 5, 5, 5, 10, 1, 15,
00156      0, 0, 0, 0, 0,
00157      16,
00158      0,
00159      0,
00160      PFD_MAIN_PLANE,
00161      0, 0, 0, 0}
00162     ,
00163     {FXMESA_COLORDEPTH, 15,
00164      FXMESA_DOUBLEBUFFER,
00165      FXMESA_ALPHA_SIZE, 1,
00166      FXMESA_DEPTH_SIZE, 16,
00167      FXMESA_STENCIL_SIZE, 0,
00168      FXMESA_ACCUM_SIZE, 0,
00169      FXMESA_NONE}
00170    }
00171    ,
00172    /* 32bit ARGB8888 single buffer with depth */
00173    {
00174     {sizeof(PIXELFORMATDESCRIPTOR), 1,
00175      PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL,
00176      PFD_TYPE_RGBA,
00177      32,
00178      8, 0, 8, 8, 8, 16, 8, 24,
00179      0, 0, 0, 0, 0,
00180      24,
00181      8,
00182      0,
00183      PFD_MAIN_PLANE,
00184      0, 0, 0, 0}
00185     ,
00186     {FXMESA_COLORDEPTH, 32,
00187      FXMESA_ALPHA_SIZE, 8,
00188      FXMESA_DEPTH_SIZE, 24,
00189      FXMESA_STENCIL_SIZE, 8,
00190      FXMESA_ACCUM_SIZE, 0,
00191      FXMESA_NONE}
00192    }
00193    ,
00194    /* 32bit ARGB8888 double buffer with depth */
00195    {
00196     {sizeof(PIXELFORMATDESCRIPTOR), 1,
00197      PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
00198      PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
00199      PFD_TYPE_RGBA,
00200      32,
00201      8, 0, 8, 8, 8, 16, 8, 24,
00202      0, 0, 0, 0, 0,
00203      24,
00204      8,
00205      0,
00206      PFD_MAIN_PLANE,
00207      0, 0, 0, 0}
00208     ,
00209     {FXMESA_COLORDEPTH, 32,
00210      FXMESA_DOUBLEBUFFER,
00211      FXMESA_ALPHA_SIZE, 8,
00212      FXMESA_DEPTH_SIZE, 24,
00213      FXMESA_STENCIL_SIZE, 8,
00214      FXMESA_ACCUM_SIZE, 0,
00215      FXMESA_NONE}
00216    }
00217 };
00218 
00219 static fxMesaContext ctx = NULL;
00220 static WNDPROC hWNDOldProc;
00221 static int curPFD = 0;
00222 static HDC hDC;
00223 static HWND hWND;
00224 
00225 static GLboolean haveDualHead;
00226 
00227 /* For the in-window-rendering hack */
00228 
00229 #ifndef GR_CONTROL_RESIZE
00230 /* Apparently GR_CONTROL_RESIZE can be ignored. OK? */
00231 #define GR_CONTROL_RESIZE -1
00232 #endif
00233 
00234 static GLboolean gdiWindowHack;
00235 static void *dibSurfacePtr;
00236 static BITMAPINFO *dibBMI;
00237 static HBITMAP dibHBM;
00238 static HWND dibWnd;
00239 
00240 static int
00241 env_check (const char *var, int val)
00242 {
00243    const char *env = getenv(var);
00244    return (env && (env[0] == val));
00245 }
00246 
00247 static LRESULT APIENTRY
00248 __wglMonitor (HWND hwnd, UINT message, UINT wParam, LONG lParam)
00249 {
00250    long ret;                    /* Now gives the resized window at the end to hWNDOldProc */
00251 
00252    if (ctx && hwnd == hWND) {
00253       switch (message) {
00254          case WM_PAINT:
00255          case WM_MOVE:
00256             break;
00257          case WM_DISPLAYCHANGE:
00258          case WM_SIZE:
00259 #if 0
00260             if (wParam != SIZE_MINIMIZED) {
00261                static int moving = 0;
00262                if (!moving) {
00263                   if (!FX_grSstControl(GR_CONTROL_RESIZE)) {
00264                      moving = 1;
00265                      SetWindowPos(hwnd, 0, 0, 0, 300, 300, SWP_NOMOVE | SWP_NOZORDER);
00266                      moving = 0;
00267                      if (!FX_grSstControl(GR_CONTROL_RESIZE)) {
00268                         /*MessageBox(0,_T("Error changing windowsize"),_T("fxMESA"),MB_OK);*/
00269                         PostMessage(hWND, WM_CLOSE, 0, 0);
00270                      }
00271                   }
00272                   /* Do the clipping in the glide library */
00273                   grClipWindow(0, 0, FX_grSstScreenWidth(), FX_grSstScreenHeight());
00274                   /* And let the new size set in the context */
00275                   fxMesaUpdateScreenSize(ctx);
00276                }
00277             }
00278 #endif
00279             break;
00280          case WM_ACTIVATE:
00281             break;
00282          case WM_SHOWWINDOW:
00283             break;
00284          case WM_SYSKEYDOWN:
00285          case WM_SYSCHAR:
00286             break;
00287       }
00288    }
00289 
00290    /* Finally call the hWNDOldProc, which handles the resize with the
00291     * now changed window sizes */
00292    ret = CallWindowProc(hWNDOldProc, hwnd, message, wParam, lParam);
00293 
00294    return ret;
00295 }
00296 
00297 static void
00298 wgl_error (long error)
00299 {
00300 #define WGL_INVALID_PIXELFORMAT ERROR_INVALID_PIXEL_FORMAT
00301    SetLastError(0xC0000000      /* error severity */
00302                |0x00070000      /* error facility (who we are) */
00303                |error);
00304 }
00305 
00306 GLAPI BOOL GLAPIENTRY
00307 wglCopyContext (HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
00308 {
00309    return FALSE;
00310 }
00311 
00312 GLAPI HGLRC GLAPIENTRY
00313 wglCreateContext (HDC hdc)
00314 {
00315    HWND hWnd;
00316    WNDPROC oldProc;
00317    int error;
00318 
00319    if (ctx) {
00320       SetLastError(0);
00321       return NULL;
00322    }
00323 
00324    if (!(hWnd = WindowFromDC(hdc))) {
00325       SetLastError(0);
00326       return NULL;
00327    }
00328 
00329    if (curPFD == 0) {
00330       wgl_error(WGL_INVALID_PIXELFORMAT);
00331       return NULL;
00332    }
00333 
00334    if ((oldProc = (WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC)) != __wglMonitor) {
00335       hWNDOldProc = oldProc;
00336       SetWindowLong(hWnd, GWL_WNDPROC, (LONG)__wglMonitor);
00337    }
00338 
00339    /* always log when debugging, or if user demands */
00340    if (TDFX_DEBUG || env_check("MESA_FX_INFO", 'r')) {
00341       freopen("MESA.LOG", "w", stderr);
00342    }
00343 
00344    {
00345       RECT cliRect;
00346       ShowWindow(hWnd, SW_SHOWNORMAL);
00347       SetForegroundWindow(hWnd);
00348       Sleep(100);               /* a hack for win95 */
00349       if (env_check("MESA_GLX_FX", 'w') && !(GetWindowLong(hWnd, GWL_STYLE) & WS_POPUP)) {
00350          /* XXX todo - windowed modes */
00351          error = !(ctx = fxMesaCreateContext((GLuint) hWnd, GR_RESOLUTION_NONE, GR_REFRESH_NONE, pix[curPFD - 1].mesaAttr));
00352       } else {
00353          GetClientRect(hWnd, &cliRect);
00354          error = !(ctx = fxMesaCreateBestContext((GLuint) hWnd, cliRect.right, cliRect.bottom, pix[curPFD - 1].mesaAttr));
00355       }
00356    }
00357 
00358    /*if (getenv("SST_DUALHEAD"))
00359       haveDualHead =
00360          ((atoi(getenv("SST_DUALHEAD")) == 1) ? GL_TRUE : GL_FALSE);
00361    else
00362       haveDualHead = GL_FALSE;*/
00363 
00364    if (error) {
00365       SetLastError(0);
00366       return NULL;
00367    }
00368 
00369    hDC = hdc;
00370    hWND = hWnd;
00371 
00372    /* Required by the OpenGL Optimizer 1.1 (is it a Optimizer bug ?) */
00373    wglMakeCurrent(hdc, (HGLRC)1);
00374 
00375    return (HGLRC)1;
00376 }
00377 
00378 GLAPI HGLRC GLAPIENTRY
00379 wglCreateLayerContext (HDC hdc, int iLayerPlane)
00380 {
00381    SetLastError(0);
00382    return NULL;
00383 }
00384 
00385 GLAPI BOOL GLAPIENTRY
00386 wglDeleteContext (HGLRC hglrc)
00387 {
00388    if (ctx && hglrc == (HGLRC)1) {
00389 
00390       fxMesaDestroyContext(ctx);
00391 
00392       SetWindowLong(WindowFromDC(hDC), GWL_WNDPROC, (LONG) hWNDOldProc);
00393 
00394       ctx = NULL;
00395       hDC = 0;
00396       return TRUE;
00397    }
00398 
00399    SetLastError(0);
00400 
00401    return FALSE;
00402 }
00403 
00404 GLAPI HGLRC GLAPIENTRY
00405 wglGetCurrentContext (VOID)
00406 {
00407    if (ctx)
00408       return (HGLRC)1;
00409 
00410    SetLastError(0);
00411    return NULL;
00412 }
00413 
00414 GLAPI HDC GLAPIENTRY
00415 wglGetCurrentDC (VOID)
00416 {
00417    if (ctx)
00418       return hDC;
00419 
00420    SetLastError(0);
00421    return NULL;
00422 }
00423 
00424 GLAPI BOOL GLAPIENTRY
00425 wglSwapIntervalEXT (int interval)
00426 {
00427    if (ctx == NULL) {
00428       return FALSE;
00429    }
00430    if (interval < 0) {
00431       interval = 0;
00432    } else if (interval > 3) {
00433       interval = 3;
00434    }
00435    ctx->swapInterval = interval;
00436    return TRUE;
00437 }
00438 
00439 GLAPI int GLAPIENTRY
00440 wglGetSwapIntervalEXT (void)
00441 {
00442    return (ctx == NULL) ? -1 : ctx->swapInterval;
00443 }
00444 
00445 GLAPI BOOL GLAPIENTRY
00446 wglGetDeviceGammaRamp3DFX (HDC hdc, LPVOID arrays)
00447 {
00448    /* gammaTable should be per-context */
00449    memcpy(arrays, gammaTable, 3 * 256 * sizeof(GLushort));
00450    return TRUE;
00451 }
00452 
00453 GLAPI BOOL GLAPIENTRY
00454 wglSetDeviceGammaRamp3DFX (HDC hdc, LPVOID arrays)
00455 {
00456    GLint i, tableSize, inc, index;
00457    GLushort *red, *green, *blue;
00458    FxU32 gammaTableR[256], gammaTableG[256], gammaTableB[256];
00459 
00460    /* gammaTable should be per-context */
00461    memcpy(gammaTable, arrays, 3 * 256 * sizeof(GLushort));
00462 
00463    tableSize = FX_grGetInteger(GR_GAMMA_TABLE_ENTRIES);
00464    inc = 256 / tableSize;
00465    red = (GLushort *)arrays;
00466    green = (GLushort *)arrays + 256;
00467    blue = (GLushort *)arrays + 512;
00468    for (i = 0, index = 0; i < tableSize; i++, index += inc) {
00469       gammaTableR[i] = red[index] >> 8;
00470       gammaTableG[i] = green[index] >> 8;
00471       gammaTableB[i] = blue[index] >> 8;
00472    }
00473 
00474    grLoadGammaTable(tableSize, gammaTableR, gammaTableG, gammaTableB);
00475 
00476    return TRUE;
00477 }
00478 
00479 typedef void *HPBUFFERARB;
00480 
00481 /* WGL_ARB_pixel_format */
00482 GLAPI BOOL GLAPIENTRY
00483 wglGetPixelFormatAttribivARB (HDC hdc,
00484                               int iPixelFormat,
00485                               int iLayerPlane,
00486                               UINT nAttributes,
00487                               const int *piAttributes,
00488                               int *piValues)
00489 {
00490    SetLastError(0);
00491    return FALSE;
00492 }
00493 
00494 GLAPI BOOL GLAPIENTRY
00495 wglGetPixelFormatAttribfvARB (HDC hdc,
00496                               int iPixelFormat,
00497                               int iLayerPlane,
00498                               UINT nAttributes,
00499                               const int *piAttributes,
00500                               FLOAT *pfValues)
00501 {
00502    SetLastError(0);
00503    return FALSE;
00504 }
00505 
00506 GLAPI BOOL GLAPIENTRY
00507 wglChoosePixelFormatARB (HDC hdc,
00508                          const int *piAttribIList,
00509                          const FLOAT *pfAttribFList,
00510                          UINT nMaxFormats,
00511                          int *piFormats,
00512                          UINT *nNumFormats)
00513 {
00514    SetLastError(0);
00515    return FALSE;
00516 }
00517 
00518 /* WGL_ARB_render_texture */
00519 GLAPI BOOL GLAPIENTRY
00520 wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer)
00521 {
00522    SetLastError(0);
00523    return FALSE;
00524 }
00525 
00526 GLAPI BOOL GLAPIENTRY
00527 wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer)
00528 {
00529    SetLastError(0);
00530    return FALSE;
00531 }
00532 
00533 GLAPI BOOL GLAPIENTRY
00534 wglSetPbufferAttribARB (HPBUFFERARB hPbuffer,
00535                         const int *piAttribList)
00536 {
00537    SetLastError(0);
00538    return FALSE;
00539 }
00540 
00541 /* WGL_ARB_pbuffer */
00542 GLAPI HPBUFFERARB GLAPIENTRY
00543 wglCreatePbufferARB (HDC hDC,
00544                      int iPixelFormat,
00545                      int iWidth,
00546                      int iHeight,
00547                      const int *piAttribList)
00548 {
00549    SetLastError(0);
00550    return NULL;
00551 }
00552 
00553 GLAPI HDC GLAPIENTRY
00554 wglGetPbufferDCARB (HPBUFFERARB hPbuffer)
00555 {
00556    SetLastError(0);
00557    return NULL;
00558 }
00559 
00560 GLAPI int GLAPIENTRY
00561 wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC)
00562 {
00563    SetLastError(0);
00564    return -1;
00565 }
00566 
00567 GLAPI BOOL GLAPIENTRY
00568 wglDestroyPbufferARB (HPBUFFERARB hPbuffer)
00569 {
00570    SetLastError(0);
00571    return FALSE;
00572 }
00573 
00574 GLAPI BOOL GLAPIENTRY
00575 wglQueryPbufferARB (HPBUFFERARB hPbuffer,
00576                     int iAttribute,
00577                     int *piValue)
00578 {
00579    SetLastError(0);
00580    return FALSE;
00581 }
00582 
00583 GLAPI const char * GLAPIENTRY
00584 wglGetExtensionsStringEXT (void)
00585 {
00586    return "WGL_3DFX_gamma_control "
00587           "WGL_EXT_swap_control "
00588           "WGL_EXT_extensions_string WGL_ARB_extensions_string"
00589          /*WGL_ARB_pixel_format WGL_ARB_render_texture WGL_ARB_pbuffer*/;
00590 }
00591 
00592 GLAPI const char * GLAPIENTRY
00593 wglGetExtensionsStringARB (HDC hdc)
00594 {
00595    return wglGetExtensionsStringEXT();
00596 }
00597 
00598 static struct {
00599    const char *name;
00600    PROC func;
00601 } wgl_ext[] = {
00602        {"wglGetExtensionsStringARB",    (PROC)wglGetExtensionsStringARB},
00603        {"wglGetExtensionsStringEXT",    (PROC)wglGetExtensionsStringEXT},
00604        {"wglSwapIntervalEXT",           (PROC)wglSwapIntervalEXT},
00605        {"wglGetSwapIntervalEXT",        (PROC)wglGetSwapIntervalEXT},
00606        {"wglGetDeviceGammaRamp3DFX",    (PROC)wglGetDeviceGammaRamp3DFX},
00607        {"wglSetDeviceGammaRamp3DFX",    (PROC)wglSetDeviceGammaRamp3DFX},
00608        /* WGL_ARB_pixel_format */
00609        {"wglGetPixelFormatAttribivARB", (PROC)wglGetPixelFormatAttribivARB},
00610        {"wglGetPixelFormatAttribfvARB", (PROC)wglGetPixelFormatAttribfvARB},
00611        {"wglChoosePixelFormatARB",      (PROC)wglChoosePixelFormatARB},
00612        /* WGL_ARB_render_texture */
00613        {"wglBindTexImageARB",           (PROC)wglBindTexImageARB},
00614        {"wglReleaseTexImageARB",        (PROC)wglReleaseTexImageARB},
00615        {"wglSetPbufferAttribARB",       (PROC)wglSetPbufferAttribARB},
00616        /* WGL_ARB_pbuffer */
00617        {"wglCreatePbufferARB",          (PROC)wglCreatePbufferARB},
00618        {"wglGetPbufferDCARB",           (PROC)wglGetPbufferDCARB},
00619        {"wglReleasePbufferDCARB",       (PROC)wglReleasePbufferDCARB},
00620        {"wglDestroyPbufferARB",         (PROC)wglDestroyPbufferARB},
00621        {"wglQueryPbufferARB",           (PROC)wglQueryPbufferARB},
00622        {NULL, NULL}
00623 };
00624 
00625 GLAPI PROC GLAPIENTRY
00626 wglGetProcAddress (LPCSTR lpszProc)
00627 {
00628    int i;
00629    PROC p = (PROC)_glapi_get_proc_address((const char *)lpszProc);
00630 
00631    /* we can't BlendColor. work around buggy applications */
00632    if (p && strcmp(lpszProc, "glBlendColor")
00633          && strcmp(lpszProc, "glBlendColorEXT"))
00634       return p;
00635 
00636    for (i = 0; wgl_ext[i].name; i++) {
00637       if (!strcmp(lpszProc, wgl_ext[i].name)) {
00638          return wgl_ext[i].func;
00639       }
00640    }
00641 
00642    SetLastError(0);
00643    return NULL;
00644 }
00645 
00646 GLAPI PROC GLAPIENTRY
00647 wglGetDefaultProcAddress (LPCSTR lpszProc)
00648 {
00649    SetLastError(0);
00650    return NULL;
00651 }
00652 
00653 GLAPI BOOL GLAPIENTRY
00654 wglMakeCurrent (HDC hdc, HGLRC hglrc)
00655 {
00656    if ((hdc == NULL) && (hglrc == NULL))
00657       return TRUE;
00658 
00659    if (!ctx || hglrc != (HGLRC)1 || WindowFromDC(hdc) != hWND) {
00660       SetLastError(0);
00661       return FALSE;
00662    }
00663 
00664    hDC = hdc;
00665 
00666    fxMesaMakeCurrent(ctx);
00667 
00668    return TRUE;
00669 }
00670 
00671 GLAPI BOOL GLAPIENTRY
00672 wglShareLists (HGLRC hglrc1, HGLRC hglrc2)
00673 {
00674    if (!ctx || hglrc1 != (HGLRC)1 || hglrc1 != hglrc2) {
00675       SetLastError(0);
00676       return FALSE;
00677    }
00678 
00679    return TRUE;
00680 }
00681 
00682 static BOOL
00683 wglUseFontBitmaps_FX (HDC fontDevice, DWORD firstChar, DWORD numChars,
00684                       DWORD listBase)
00685 {
00686    TEXTMETRIC metric;
00687    BITMAPINFO *dibInfo;
00688    HDC bitDevice;
00689    COLORREF tempColor;
00690    int i;
00691 
00692    GetTextMetrics(fontDevice, &metric);
00693 
00694    dibInfo = (BITMAPINFO *)calloc(sizeof(BITMAPINFO) + sizeof(RGBQUAD), 1);
00695    dibInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
00696    dibInfo->bmiHeader.biPlanes = 1;
00697    dibInfo->bmiHeader.biBitCount = 1;
00698    dibInfo->bmiHeader.biCompression = BI_RGB;
00699 
00700    bitDevice = CreateCompatibleDC(fontDevice);
00701 
00702    /* Swap fore and back colors so the bitmap has the right polarity */
00703    tempColor = GetBkColor(bitDevice);
00704    SetBkColor(bitDevice, GetTextColor(bitDevice));
00705    SetTextColor(bitDevice, tempColor);
00706 
00707    /* Place chars based on base line */
00708    SetTextAlign(bitDevice, TA_BASELINE);
00709 
00710    for (i = 0; i < (int)numChars; i++) {
00711       SIZE size;
00712       char curChar;
00713       int charWidth, charHeight, bmapWidth, bmapHeight, numBytes, res;
00714       HBITMAP bitObject;
00715       HGDIOBJ origBmap;
00716       unsigned char *bmap;
00717 
00718       curChar = (char)(i + firstChar); /* [koolsmoky] explicit cast */
00719 
00720       /* Find how high/wide this character is */
00721       GetTextExtentPoint32(bitDevice, &curChar, 1, &size);
00722 
00723       /* Create the output bitmap */
00724       charWidth = size.cx;
00725       charHeight = size.cy;
00726       bmapWidth = ((charWidth + 31) / 32) * 32; /* Round up to the next multiple of 32 bits */
00727       bmapHeight = charHeight;
00728       bitObject = CreateCompatibleBitmap(bitDevice, bmapWidth, bmapHeight);
00729       /*VERIFY(bitObject);*/
00730 
00731       /* Assign the output bitmap to the device */
00732       origBmap = SelectObject(bitDevice, bitObject);
00733 
00734       PatBlt(bitDevice, 0, 0, bmapWidth, bmapHeight, BLACKNESS);
00735 
00736       /* Use our source font on the device */
00737       SelectObject(bitDevice, GetCurrentObject(fontDevice, OBJ_FONT));
00738 
00739       /* Draw the character */
00740       TextOut(bitDevice, 0, metric.tmAscent, &curChar, 1);
00741 
00742       /* Unselect our bmap object */
00743       SelectObject(bitDevice, origBmap);
00744 
00745       /* Convert the display dependant representation to a 1 bit deep DIB */
00746       numBytes = (bmapWidth * bmapHeight) / 8;
00747       bmap = MALLOC(numBytes);
00748       dibInfo->bmiHeader.biWidth = bmapWidth;
00749       dibInfo->bmiHeader.biHeight = bmapHeight;
00750       res = GetDIBits(bitDevice, bitObject, 0, bmapHeight, bmap,
00751                       dibInfo, DIB_RGB_COLORS);
00752 
00753       /* Create the GL object */
00754       glNewList(i + listBase, GL_COMPILE);
00755       glBitmap(bmapWidth, bmapHeight, 0.0, metric.tmDescent,
00756                charWidth, 0.0, bmap);
00757       glEndList();
00758       /* CheckGL(); */
00759 
00760       /* Destroy the bmap object */
00761       DeleteObject(bitObject);
00762 
00763       /* Deallocate the bitmap data */
00764       FREE(bmap);
00765    }
00766 
00767    /* Destroy the DC */
00768    DeleteDC(bitDevice);
00769 
00770    FREE(dibInfo);
00771 
00772    return TRUE;
00773 }
00774 
00775 GLAPI BOOL GLAPIENTRY
00776 wglUseFontBitmapsW (HDC hdc, DWORD first, DWORD count, DWORD listBase)
00777 {
00778    return FALSE;
00779 }
00780 
00781 GLAPI BOOL GLAPIENTRY
00782 wglUseFontOutlinesA (HDC hdc, DWORD first, DWORD count,
00783                      DWORD listBase, FLOAT deviation,
00784                      FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf)
00785 {
00786    SetLastError(0);
00787    return FALSE;
00788 }
00789 
00790 GLAPI BOOL GLAPIENTRY
00791 wglUseFontOutlinesW (HDC hdc, DWORD first, DWORD count,
00792                      DWORD listBase, FLOAT deviation,
00793                      FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf)
00794 {
00795    SetLastError(0);
00796    return FALSE;
00797 }
00798 
00799 
00800 GLAPI BOOL GLAPIENTRY
00801 wglSwapLayerBuffers (HDC hdc, UINT fuPlanes)
00802 {
00803    if (ctx && WindowFromDC(hdc) == hWND) {
00804       fxMesaSwapBuffers();
00805 
00806       return TRUE;
00807    }
00808 
00809    SetLastError(0);
00810    return FALSE;
00811 }
00812 
00813 static int
00814 pfd_tablen (void)
00815 {
00816    /* we should take an envvar for `fxMesaSelectCurrentBoard' */
00817    return (fxMesaSelectCurrentBoard(0) < GR_SSTTYPE_Voodoo4)
00818          ? 2                      /* only 16bit entries */
00819          : sizeof(pix) / sizeof(pix[0]);  /* full table */
00820 }
00821 
00822 GLAPI int GLAPIENTRY
00823 wglChoosePixelFormat (HDC hdc, const PIXELFORMATDESCRIPTOR *ppfd)
00824 {
00825    int i, best = -1, qt_valid_pix;
00826    PIXELFORMATDESCRIPTOR pfd = *ppfd;
00827 
00828    qt_valid_pix = pfd_tablen();
00829 
00830 #if 1 || QUAKE2 || GORE
00831    /* QUAKE2: 24+32 */
00832    /* GORE  : 24+16 */
00833    if ((pfd.cColorBits == 24) || (pfd.cColorBits == 32)) {
00834       /* the first 2 entries are 16bit */
00835       pfd.cColorBits = (qt_valid_pix > 2) ? 32 : 16;
00836    }
00837    if (pfd.cColorBits == 32) {
00838       pfd.cDepthBits = 24;
00839    } else if (pfd.cColorBits == 16) {
00840       pfd.cDepthBits = 16;
00841    }
00842 #endif
00843 
00844    if (pfd.nSize != sizeof(PIXELFORMATDESCRIPTOR) || pfd.nVersion != 1) {
00845       SetLastError(0);
00846       return 0;
00847    }
00848 
00849    for (i = 0; i < qt_valid_pix; i++) {
00850       if (pfd.cColorBits > 0 && pix[i].pfd.cColorBits != pfd.cColorBits)
00851          continue;
00852 
00853       if ((pfd.dwFlags & PFD_DRAW_TO_WINDOW)
00854           && !(pix[i].pfd.dwFlags & PFD_DRAW_TO_WINDOW)) continue;
00855       if ((pfd.dwFlags & PFD_DRAW_TO_BITMAP)
00856           && !(pix[i].pfd.dwFlags & PFD_DRAW_TO_BITMAP)) continue;
00857       if ((pfd.dwFlags & PFD_SUPPORT_GDI)
00858           && !(pix[i].pfd.dwFlags & PFD_SUPPORT_GDI)) continue;
00859       if ((pfd.dwFlags & PFD_SUPPORT_OPENGL)
00860           && !(pix[i].pfd.dwFlags & PFD_SUPPORT_OPENGL)) continue;
00861       if (!(pfd.dwFlags & PFD_DOUBLEBUFFER_DONTCARE)
00862           && ((pfd.dwFlags & PFD_DOUBLEBUFFER) !=
00863               (pix[i].pfd.dwFlags & PFD_DOUBLEBUFFER))) continue;
00864 #if 1 /* Doom3 fails here! */
00865       if (!(pfd.dwFlags & PFD_STEREO_DONTCARE)
00866           && ((pfd.dwFlags & PFD_STEREO) !=
00867               (pix[i].pfd.dwFlags & PFD_STEREO))) continue;
00868 #endif
00869 
00870       if (pfd.cDepthBits > 0 && pix[i].pfd.cDepthBits == 0)
00871          continue;              /* need depth buffer */
00872 
00873       if (pfd.cAlphaBits > 0 && pix[i].pfd.cAlphaBits == 0)
00874          continue;              /* need alpha buffer */
00875 
00876 #if 0                           /* regression bug? */
00877       if (pfd.cStencilBits > 0 && pix[i].pfd.cStencilBits == 0)
00878          continue;              /* need stencil buffer */
00879 #endif
00880 
00881       if (pfd.iPixelType == pix[i].pfd.iPixelType) {
00882          best = i + 1;
00883          break;
00884       }
00885    }
00886 
00887    if (best == -1) {
00888       FILE *err = fopen("MESA.LOG", "w");
00889       if (err != NULL) {
00890          fprintf(err, "wglChoosePixelFormat failed\n");
00891          fprintf(err, "\tnSize           = %d\n", ppfd->nSize);
00892          fprintf(err, "\tnVersion        = %d\n", ppfd->nVersion);
00893          fprintf(err, "\tdwFlags         = %lu\n", ppfd->dwFlags);
00894          fprintf(err, "\tiPixelType      = %d\n", ppfd->iPixelType);
00895          fprintf(err, "\tcColorBits      = %d\n", ppfd->cColorBits);
00896          fprintf(err, "\tcRedBits        = %d\n", ppfd->cRedBits);
00897          fprintf(err, "\tcRedShift       = %d\n", ppfd->cRedShift);
00898          fprintf(err, "\tcGreenBits      = %d\n", ppfd->cGreenBits);
00899          fprintf(err, "\tcGreenShift     = %d\n", ppfd->cGreenShift);
00900          fprintf(err, "\tcBlueBits       = %d\n", ppfd->cBlueBits);
00901          fprintf(err, "\tcBlueShift      = %d\n", ppfd->cBlueShift);
00902          fprintf(err, "\tcAlphaBits      = %d\n", ppfd->cAlphaBits);
00903          fprintf(err, "\tcAlphaShift     = %d\n", ppfd->cAlphaShift);
00904          fprintf(err, "\tcAccumBits      = %d\n", ppfd->cAccumBits);
00905          fprintf(err, "\tcAccumRedBits   = %d\n", ppfd->cAccumRedBits);
00906          fprintf(err, "\tcAccumGreenBits = %d\n", ppfd->cAccumGreenBits);
00907          fprintf(err, "\tcAccumBlueBits  = %d\n", ppfd->cAccumBlueBits);
00908          fprintf(err, "\tcAccumAlphaBits = %d\n", ppfd->cAccumAlphaBits);
00909          fprintf(err, "\tcDepthBits      = %d\n", ppfd->cDepthBits);
00910          fprintf(err, "\tcStencilBits    = %d\n", ppfd->cStencilBits);
00911          fprintf(err, "\tcAuxBuffers     = %d\n", ppfd->cAuxBuffers);
00912          fprintf(err, "\tiLayerType      = %d\n", ppfd->iLayerType);
00913          fprintf(err, "\tbReserved       = %d\n", ppfd->bReserved);
00914          fprintf(err, "\tdwLayerMask     = %lu\n", ppfd->dwLayerMask);
00915          fprintf(err, "\tdwVisibleMask   = %lu\n", ppfd->dwVisibleMask);
00916          fprintf(err, "\tdwDamageMask    = %lu\n", ppfd->dwDamageMask);
00917          fclose(err);
00918       }
00919 
00920       SetLastError(0);
00921       return 0;
00922    }
00923 
00924    return best;
00925 }
00926 
00927 GLAPI int GLAPIENTRY
00928 ChoosePixelFormat (HDC hdc, const PIXELFORMATDESCRIPTOR *ppfd)
00929 {
00930 
00931    return wglChoosePixelFormat(hdc, ppfd);
00932 }
00933 
00934 GLAPI int GLAPIENTRY
00935 wglDescribePixelFormat (HDC hdc, int iPixelFormat, UINT nBytes,
00936                         LPPIXELFORMATDESCRIPTOR ppfd)
00937 {
00938    int qt_valid_pix;
00939 
00940    qt_valid_pix = pfd_tablen();
00941 
00942    if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix ||
00943        ((nBytes != sizeof(PIXELFORMATDESCRIPTOR)) && (nBytes != 0))) {
00944       SetLastError(0);
00945       return qt_valid_pix;
00946    }
00947 
00948    if (nBytes != 0)
00949       *ppfd = pix[iPixelFormat - 1].pfd;
00950 
00951    return qt_valid_pix;
00952 }
00953 
00954 GLAPI int GLAPIENTRY
00955 DescribePixelFormat (HDC hdc, int iPixelFormat, UINT nBytes,
00956                      LPPIXELFORMATDESCRIPTOR ppfd)
00957 {
00958    return wglDescribePixelFormat(hdc, iPixelFormat, nBytes, ppfd);
00959 }
00960 
00961 GLAPI int GLAPIENTRY
00962 wglGetPixelFormat (HDC hdc)
00963 {
00964    if (curPFD == 0) {
00965       SetLastError(0);
00966       return 0;
00967    }
00968 
00969    return curPFD;
00970 }
00971 
00972 GLAPI int GLAPIENTRY
00973 GetPixelFormat (HDC hdc)
00974 {
00975    return wglGetPixelFormat(hdc);
00976 }
00977 
00978 GLAPI BOOL GLAPIENTRY
00979 wglSetPixelFormat (HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd)
00980 {
00981    int qt_valid_pix;
00982 
00983    qt_valid_pix = pfd_tablen();
00984 
00985    if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix) {
00986       if (ppfd == NULL) {
00987          PIXELFORMATDESCRIPTOR my_pfd;
00988          if (!wglDescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &my_pfd)) {
00989             SetLastError(0);
00990             return FALSE;
00991          }
00992       } else if (ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR)) {
00993          SetLastError(0);
00994          return FALSE;
00995       }
00996    }
00997    curPFD = iPixelFormat;
00998 
00999    return TRUE;
01000 }
01001 
01002 GLAPI BOOL GLAPIENTRY
01003 wglSwapBuffers (HDC hdc)
01004 {
01005    if (!ctx) {
01006       SetLastError(0);
01007       return FALSE;
01008    }
01009 
01010    fxMesaSwapBuffers();
01011 
01012    return TRUE;
01013 }
01014 
01015 GLAPI BOOL GLAPIENTRY
01016 SetPixelFormat (HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd)
01017 {
01018    return wglSetPixelFormat(hdc, iPixelFormat, ppfd);
01019 }
01020 
01021 GLAPI BOOL GLAPIENTRY
01022 SwapBuffers(HDC hdc)
01023 {
01024    return wglSwapBuffers(hdc);
01025 }
01026 
01027 static FIXED
01028 FixedFromDouble (double d)
01029 {
01030    struct {
01031       FIXED f;
01032       long l;
01033    } pun;
01034    pun.l = (long)(d * 65536L);
01035    return pun.f;
01036 }
01037 
01038 /*
01039 ** This was yanked from windows/gdi/wgl.c
01040 */
01041 GLAPI BOOL GLAPIENTRY
01042 wglUseFontBitmapsA (HDC hdc, DWORD first, DWORD count, DWORD listBase)
01043 {
01044    int i;
01045    GLuint font_list;
01046    DWORD size;
01047    GLYPHMETRICS gm;
01048    HANDLE hBits;
01049    LPSTR lpBits;
01050    MAT2 mat;
01051    int success = TRUE;
01052 
01053    font_list = listBase;
01054 
01055    mat.eM11 = FixedFromDouble(1);
01056    mat.eM12 = FixedFromDouble(0);
01057    mat.eM21 = FixedFromDouble(0);
01058    mat.eM22 = FixedFromDouble(-1);
01059 
01060    memset(&gm, 0, sizeof(gm));
01061 
01062    /*
01063     ** If we can't get the glyph outline, it may be because this is a fixed
01064     ** font.  Try processing it that way.
01065     */
01066    if (GetGlyphOutline(hdc, first, GGO_BITMAP, &gm, 0, NULL, &mat) == GDI_ERROR) {
01067       return wglUseFontBitmaps_FX(hdc, first, count, listBase);
01068    }
01069 
01070    /*
01071     ** Otherwise process all desired characters.
01072     */
01073    for (i = 0; i < count; i++) {
01074       DWORD err;
01075 
01076       glNewList(font_list + i, GL_COMPILE);
01077 
01078       /* allocate space for the bitmap/outline */
01079       size = GetGlyphOutline(hdc, first + i, GGO_BITMAP, &gm, 0, NULL, &mat);
01080       if (size == GDI_ERROR) {
01081          glEndList();
01082          err = GetLastError();
01083          success = FALSE;
01084          continue;
01085       }
01086 
01087       hBits = GlobalAlloc(GHND, size + 1);
01088       lpBits = GlobalLock(hBits);
01089 
01090       err = GetGlyphOutline(hdc,        /* handle to device context */
01091                             first + i,  /* character to query */
01092                             GGO_BITMAP, /* format of data to return */
01093                             &gm,        /* pointer to structure for metrics */
01094                             size,       /* size of buffer for data */
01095                             lpBits,     /* pointer to buffer for data */
01096                             &mat        /* pointer to transformation */
01097                                         /* matrix structure */
01098           );
01099 
01100       if (err == GDI_ERROR) {
01101          GlobalUnlock(hBits);
01102          GlobalFree(hBits);
01103 
01104          glEndList();
01105          err = GetLastError();
01106          success = FALSE;
01107          continue;
01108       }
01109 
01110       glBitmap(gm.gmBlackBoxX, gm.gmBlackBoxY,
01111                -gm.gmptGlyphOrigin.x,
01112                gm.gmptGlyphOrigin.y,
01113                gm.gmCellIncX, gm.gmCellIncY,
01114                (const GLubyte *)lpBits);
01115 
01116       GlobalUnlock(hBits);
01117       GlobalFree(hBits);
01118 
01119       glEndList();
01120    }
01121 
01122    return success;
01123 }
01124 
01125 GLAPI BOOL GLAPIENTRY
01126 wglDescribeLayerPlane (HDC hdc, int iPixelFormat, int iLayerPlane,
01127                        UINT nBytes, LPLAYERPLANEDESCRIPTOR ppfd)
01128 {
01129    SetLastError(0);
01130    return FALSE;
01131 }
01132 
01133 GLAPI int GLAPIENTRY
01134 wglGetLayerPaletteEntries (HDC hdc, int iLayerPlane, int iStart,
01135                            int cEntries, COLORREF *pcr)
01136 {
01137    SetLastError(0);
01138    return FALSE;
01139 }
01140 
01141 GLAPI BOOL GLAPIENTRY
01142 wglRealizeLayerPalette (HDC hdc, int iLayerPlane, BOOL bRealize)
01143 {
01144    SetLastError(0);
01145    return FALSE;
01146 }
01147 
01148 GLAPI int GLAPIENTRY
01149 wglSetLayerPaletteEntries (HDC hdc, int iLayerPlane, int iStart,
01150                            int cEntries, CONST COLORREF *pcr)
01151 {
01152    SetLastError(0);
01153    return FALSE;
01154 }
01155 
01156 
01157 /***************************************************************************
01158  * [dBorca] simplistic ICD implementation, based on ICD code by Gregor Anich
01159  */
01160 
01161 typedef struct _icdTable {
01162    DWORD size;
01163    PROC table[336];
01164 } ICDTABLE, *PICDTABLE;
01165 
01166 #ifdef USE_MGL_NAMESPACE
01167 #define GL_FUNC(func) mgl##func
01168 #else
01169 #define GL_FUNC(func) gl##func
01170 #endif
01171 
01172 static ICDTABLE icdTable = { 336, {
01173 #define ICD_ENTRY(func) (PROC)GL_FUNC(func),
01174 #include "../icd/icdlist.h"
01175 #undef ICD_ENTRY
01176 } };
01177 
01178 
01179 GLAPI BOOL GLAPIENTRY
01180 DrvCopyContext (HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
01181 {
01182    return wglCopyContext(hglrcSrc, hglrcDst, mask);
01183 }
01184 
01185 
01186 GLAPI HGLRC GLAPIENTRY
01187 DrvCreateContext (HDC hdc)
01188 {
01189    return wglCreateContext(hdc);
01190 }
01191 
01192 
01193 GLAPI BOOL GLAPIENTRY
01194 DrvDeleteContext (HGLRC hglrc)
01195 {
01196    return wglDeleteContext(hglrc);
01197 }
01198 
01199 
01200 GLAPI HGLRC GLAPIENTRY
01201 DrvCreateLayerContext (HDC hdc, int iLayerPlane)
01202 {
01203    return wglCreateContext(hdc);
01204 }
01205 
01206 
01207 GLAPI PICDTABLE GLAPIENTRY
01208 DrvSetContext (HDC hdc, HGLRC hglrc, void *callback)
01209 {
01210    return wglMakeCurrent(hdc, hglrc) ? &icdTable : NULL;
01211 }
01212 
01213 
01214 GLAPI BOOL GLAPIENTRY
01215 DrvReleaseContext (HGLRC hglrc)
01216 {
01217    return TRUE;
01218 }
01219 
01220 
01221 GLAPI BOOL GLAPIENTRY
01222 DrvShareLists (HGLRC hglrc1, HGLRC hglrc2)
01223 {
01224    return wglShareLists(hglrc1, hglrc2);
01225 }
01226 
01227 
01228 GLAPI BOOL GLAPIENTRY
01229 DrvDescribeLayerPlane (HDC hdc, int iPixelFormat,
01230                        int iLayerPlane, UINT nBytes,
01231                        LPLAYERPLANEDESCRIPTOR plpd)
01232 {
01233    return wglDescribeLayerPlane(hdc, iPixelFormat, iLayerPlane, nBytes, plpd);
01234 }
01235 
01236 
01237 GLAPI int GLAPIENTRY
01238 DrvSetLayerPaletteEntries (HDC hdc, int iLayerPlane,
01239                            int iStart, int cEntries, CONST COLORREF *pcr)
01240 {
01241    return wglSetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr);
01242 }
01243 
01244 
01245 GLAPI int GLAPIENTRY
01246 DrvGetLayerPaletteEntries (HDC hdc, int iLayerPlane,
01247                            int iStart, int cEntries, COLORREF *pcr)
01248 {
01249    return wglGetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr);
01250 }
01251 
01252 
01253 GLAPI BOOL GLAPIENTRY
01254 DrvRealizeLayerPalette (HDC hdc, int iLayerPlane, BOOL bRealize)
01255 {
01256    return wglRealizeLayerPalette(hdc, iLayerPlane, bRealize);
01257 }
01258 
01259 
01260 GLAPI BOOL GLAPIENTRY
01261 DrvSwapLayerBuffers (HDC hdc, UINT fuPlanes)
01262 {
01263    return wglSwapLayerBuffers(hdc, fuPlanes);
01264 }
01265 
01266 GLAPI int GLAPIENTRY
01267 DrvDescribePixelFormat (HDC hdc, int iPixelFormat, UINT nBytes,
01268                         LPPIXELFORMATDESCRIPTOR ppfd)
01269 {
01270    return wglDescribePixelFormat(hdc, iPixelFormat, nBytes, ppfd);
01271 }
01272 
01273 
01274 GLAPI PROC GLAPIENTRY
01275 DrvGetProcAddress (LPCSTR lpszProc)
01276 {
01277    return wglGetProcAddress(lpszProc);
01278 }
01279 
01280 
01281 GLAPI BOOL GLAPIENTRY
01282 DrvSetPixelFormat (HDC hdc, int iPixelFormat)
01283 {
01284    return wglSetPixelFormat(hdc, iPixelFormat, NULL);
01285 }
01286 
01287 
01288 GLAPI BOOL GLAPIENTRY
01289 DrvSwapBuffers (HDC hdc)
01290 {
01291    return wglSwapBuffers(hdc);
01292 }
01293 
01294 
01295 GLAPI BOOL GLAPIENTRY
01296 DrvValidateVersion (DWORD version)
01297 {
01298    (void)version;
01299    return TRUE;
01300 }
01301 
01302 
01303 #if (_MSC_VER >= 1200)
01304 #pragma warning( pop )
01305 #endif
01306 
01307 #endif /* FX */

Generated on Sun May 27 2012 04:19:57 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.