1/* 2 * File: wgl_ext_api.c 3 * Purpose: Wrapper functions for Win32 OpenGL wgl extension functions 4 * 5 * Authors: Jon TURNEY 6 * 7 * Copyright (c) Jon TURNEY 2009 8 * 9 * 10 * Permission is hereby granted, free of charge, to any person obtaining a 11 * copy of this software and associated documentation files (the "Software"), 12 * to deal in the Software without restriction, including without limitation 13 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 * and/or sell copies of the Software, and to permit persons to whom the 15 * Software is furnished to do so, subject to the following conditions: 16 * 17 * The above copyright notice and this permission notice shall be included in 18 * all copies or substantial portions of the Software. 19 * 20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 23 * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 26 * DEALINGS IN THE SOFTWARE. 27 */ 28 29#ifdef HAVE_XWIN_CONFIG_H 30#include <xwin-config.h> 31#endif 32 33#include <X11/Xwindows.h> 34#include <GL/gl.h> 35#include <GL/glext.h> 36#include <glx/glxserver.h> 37#include <glx/glxext.h> 38#include "wglext.h" 39#include <wgl_ext_api.h> 40#include "glwindows.h" 41 42#define RESOLVE_DECL(type) \ 43 static type type##proc = NULL; 44 45#define PRERESOLVE(type, symbol) \ 46 type##proc = (type)wglGetProcAddress(symbol); \ 47 if (type##proc == NULL) \ 48 ErrorF("wglwrap: Can't resolve \"%s\"\n", symbol); \ 49 else \ 50 ErrorF("wglwrap: Resolved \"%s\"\n", symbol); 51 52#define RESOLVE_RET(type, symbol, retval) \ 53 if (type##proc == NULL) { \ 54 __glXErrorCallBack(0); \ 55 return retval; \ 56 } 57 58#define RESOLVE(procname, symbol) RESOLVE_RET(procname, symbol,) 59 60#define RESOLVED_PROC(type) type##proc 61 62/* 63 * Include generated cdecl wrappers for stdcall WGL functions 64 * 65 * There are extensions to the wgl*() API as well; again we call 66 * these functions by using wglGetProcAddress() to get a pointer 67 * to the function, and wrapping it for cdecl/stdcall conversion 68 * 69 * We arrange to resolve the functions up front, as they need a 70 * context to work, as we like to use them to be able to select 71 * a context. Again, this assumption fails badly on multimontor 72 * systems... 73 */ 74 75#include "generated_wgl_wrappers.c" 76