2000-05-12 22:18:14 +02:00
|
|
|
/* Window-specific OpenGL functions implementation.
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* Copyright (c) 1999 Lionel Ulmer
|
2005-04-28 20:31:15 +02:00
|
|
|
* Copyright (c) 2005 Raphael Junqueira
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-10 00:29:33 +01:00
|
|
|
*/
|
2000-05-12 22:18:14 +02:00
|
|
|
|
2001-10-14 18:18:52 +02:00
|
|
|
#include "config.h"
|
2004-01-20 23:48:57 +01:00
|
|
|
#include "wine/port.h"
|
2001-10-14 18:18:52 +02:00
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2000-05-12 22:18:14 +02:00
|
|
|
#include <stdlib.h>
|
2001-01-22 03:17:29 +01:00
|
|
|
#include <string.h>
|
2000-05-12 22:18:14 +02:00
|
|
|
|
|
|
|
#include "windef.h"
|
2002-03-23 22:43:56 +01:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
2005-04-28 20:31:15 +02:00
|
|
|
#include "winreg.h"
|
2005-12-03 18:01:51 +01:00
|
|
|
#include "wingdi.h"
|
2006-03-20 17:55:06 +01:00
|
|
|
#include "winternl.h"
|
|
|
|
#include "winnt.h"
|
2000-05-12 22:18:14 +02:00
|
|
|
|
|
|
|
#include "opengl_ext.h"
|
2006-03-07 14:55:35 +01:00
|
|
|
#ifdef HAVE_GL_GLU_H
|
|
|
|
#undef far
|
|
|
|
#undef near
|
|
|
|
#include <GL/glu.h>
|
|
|
|
#endif
|
2004-01-20 23:48:57 +01:00
|
|
|
#include "wine/library.h"
|
2002-03-23 22:43:56 +01:00
|
|
|
#include "wine/debug.h"
|
2000-05-12 22:18:14 +02:00
|
|
|
|
2006-03-25 13:07:23 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(wgl);
|
|
|
|
WINE_DECLARE_DEBUG_CHANNEL(opengl);
|
2000-05-12 22:18:14 +02:00
|
|
|
|
2006-08-29 16:56:57 +02:00
|
|
|
typedef struct wine_wgl_s {
|
2006-09-11 21:28:32 +02:00
|
|
|
PROC WINAPI (*p_wglGetProcAddress)(LPCSTR lpszProc);
|
2006-08-29 16:58:49 +02:00
|
|
|
|
2006-08-29 16:56:57 +02:00
|
|
|
void WINAPI (*p_wglGetIntegerv)(GLenum pname, GLint* params);
|
2007-09-23 05:45:27 +02:00
|
|
|
void WINAPI (*p_wglFinish)(void);
|
|
|
|
void WINAPI (*p_wglFlush)(void);
|
2006-08-29 16:56:57 +02:00
|
|
|
} wine_wgl_t;
|
|
|
|
|
|
|
|
/** global wgl object */
|
|
|
|
static wine_wgl_t wine_wgl;
|
2005-12-22 13:54:01 +01:00
|
|
|
|
2008-05-01 14:44:49 +02:00
|
|
|
#ifdef SONAME_LIBGLU
|
|
|
|
#define MAKE_FUNCPTR(f) static typeof(f) * p##f;
|
|
|
|
MAKE_FUNCPTR(gluNewTess)
|
|
|
|
MAKE_FUNCPTR(gluDeleteTess)
|
|
|
|
MAKE_FUNCPTR(gluTessBeginContour)
|
|
|
|
MAKE_FUNCPTR(gluTessBeginPolygon)
|
|
|
|
MAKE_FUNCPTR(gluTessCallback)
|
|
|
|
MAKE_FUNCPTR(gluTessEndContour)
|
|
|
|
MAKE_FUNCPTR(gluTessEndPolygon)
|
|
|
|
MAKE_FUNCPTR(gluTessVertex)
|
|
|
|
#undef MAKE_FUNCPTR
|
|
|
|
#endif /* SONAME_LIBGLU */
|
|
|
|
|
2003-04-22 06:05:08 +02:00
|
|
|
/* x11drv GDI escapes */
|
|
|
|
#define X11DRV_ESCAPE 6789
|
|
|
|
enum x11drv_escape_codes
|
|
|
|
{
|
2005-12-19 17:45:13 +01:00
|
|
|
X11DRV_GET_DISPLAY, /* get X11 display for a DC */
|
|
|
|
X11DRV_GET_DRAWABLE, /* get current drawable for a DC */
|
|
|
|
X11DRV_GET_FONT, /* get current X font for a DC */
|
|
|
|
X11DRV_SET_DRAWABLE, /* set current drawable for a DC */
|
|
|
|
X11DRV_START_EXPOSURES, /* start graphics exposures */
|
|
|
|
X11DRV_END_EXPOSURES, /* end graphics exposures */
|
|
|
|
X11DRV_GET_DCE, /* get the DCE pointer */
|
|
|
|
X11DRV_SET_DCE, /* set the DCE pointer */
|
2006-02-02 13:23:55 +01:00
|
|
|
X11DRV_GET_GLX_DRAWABLE, /* get current glx drawable for a DC */
|
|
|
|
X11DRV_SYNC_PIXMAP /* sync the dibsection to its pixmap */
|
2003-04-22 06:05:08 +02:00
|
|
|
};
|
|
|
|
|
2002-09-25 02:29:56 +02:00
|
|
|
void (*wine_tsx11_lock_ptr)(void) = NULL;
|
|
|
|
void (*wine_tsx11_unlock_ptr)(void) = NULL;
|
|
|
|
|
2004-02-12 01:35:01 +01:00
|
|
|
static HMODULE opengl32_handle;
|
2008-05-01 14:44:49 +02:00
|
|
|
static void* libglu_handle = NULL;
|
2004-02-12 01:35:01 +01:00
|
|
|
|
2008-03-24 01:15:31 +01:00
|
|
|
static char* internal_gl_disabled_extensions = NULL;
|
2005-04-28 20:31:15 +02:00
|
|
|
static char* internal_gl_extensions = NULL;
|
|
|
|
|
2000-05-30 22:04:21 +02:00
|
|
|
typedef struct wine_glcontext {
|
|
|
|
HDC hdc;
|
2006-03-20 17:55:06 +01:00
|
|
|
BOOL do_escape;
|
2006-12-07 16:45:58 +01:00
|
|
|
/* ... more stuff here */
|
2000-05-30 22:04:21 +02:00
|
|
|
} Wine_GLContext;
|
2002-03-23 22:43:56 +01:00
|
|
|
|
2006-02-02 13:23:55 +01:00
|
|
|
void enter_gl(void)
|
|
|
|
{
|
2009-04-14 09:55:39 +02:00
|
|
|
Wine_GLContext *curctx = NtCurrentTeb()->glContext;
|
|
|
|
|
2006-03-20 17:55:06 +01:00
|
|
|
if (curctx && curctx->do_escape)
|
|
|
|
{
|
|
|
|
enum x11drv_escape_codes escape = X11DRV_SYNC_PIXMAP;
|
|
|
|
ExtEscape(curctx->hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape, 0, NULL);
|
|
|
|
}
|
2006-02-02 13:23:55 +01:00
|
|
|
|
|
|
|
wine_tsx11_lock_ptr();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-12-12 17:59:44 +01:00
|
|
|
const GLubyte * WINAPI wine_glGetString( GLenum name );
|
|
|
|
|
2000-05-18 02:07:53 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* wglCreateLayerContext (OPENGL32.@)
|
2000-05-18 02:07:53 +02:00
|
|
|
*/
|
2000-05-12 22:18:14 +02:00
|
|
|
HGLRC WINAPI wglCreateLayerContext(HDC hdc,
|
|
|
|
int iLayerPlane) {
|
2002-11-30 02:55:59 +01:00
|
|
|
TRACE("(%p,%d)\n", hdc, iLayerPlane);
|
|
|
|
|
|
|
|
if (iLayerPlane == 0) {
|
|
|
|
return wglCreateContext(hdc);
|
|
|
|
}
|
|
|
|
FIXME(" no handler for layer %d\n", iLayerPlane);
|
2000-05-12 22:18:14 +02:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2000-05-18 02:07:53 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* wglDescribeLayerPlane (OPENGL32.@)
|
2000-05-18 02:07:53 +02:00
|
|
|
*/
|
2000-05-12 22:18:14 +02:00
|
|
|
BOOL WINAPI wglDescribeLayerPlane(HDC hdc,
|
|
|
|
int iPixelFormat,
|
|
|
|
int iLayerPlane,
|
|
|
|
UINT nBytes,
|
|
|
|
LPLAYERPLANEDESCRIPTOR plpd) {
|
2002-10-19 01:48:57 +02:00
|
|
|
FIXME("(%p,%d,%d,%d,%p)\n", hdc, iPixelFormat, iLayerPlane, nBytes, plpd);
|
2000-05-12 22:18:14 +02:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-05-18 02:07:53 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* wglGetLayerPaletteEntries (OPENGL32.@)
|
2000-05-18 02:07:53 +02:00
|
|
|
*/
|
2000-05-12 22:18:14 +02:00
|
|
|
int WINAPI wglGetLayerPaletteEntries(HDC hdc,
|
|
|
|
int iLayerPlane,
|
|
|
|
int iStart,
|
|
|
|
int cEntries,
|
|
|
|
const COLORREF *pcr) {
|
|
|
|
FIXME("(): stub !\n");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int compar(const void *elt_a, const void *elt_b) {
|
2004-11-30 22:38:57 +01:00
|
|
|
return strcmp(((const OpenGL_extension *) elt_a)->name,
|
|
|
|
((const OpenGL_extension *) elt_b)->name);
|
2000-05-12 22:18:14 +02:00
|
|
|
}
|
|
|
|
|
2006-10-29 22:56:27 +01:00
|
|
|
/* Check if a GL extension is supported */
|
|
|
|
static BOOL is_extension_supported(const char* extension)
|
|
|
|
{
|
2006-12-12 17:59:44 +01:00
|
|
|
const char *gl_ext_string = (const char*)wine_glGetString(GL_EXTENSIONS);
|
2006-10-29 22:56:27 +01:00
|
|
|
|
|
|
|
TRACE("Checking for extension '%s'\n", extension);
|
|
|
|
|
|
|
|
if(!gl_ext_string) {
|
|
|
|
ERR("No OpenGL extensions found, check if your OpenGL setup is correct!\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We use the GetProcAddress function from the display driver to retrieve function pointers
|
|
|
|
* for OpenGL and WGL extensions. In case of winex11.drv the OpenGL extension lookup is done
|
|
|
|
* using glXGetProcAddress. This function is quite unreliable in the sense that its specs don't
|
|
|
|
* require the function to return NULL when a extension isn't found. For this reason we check
|
|
|
|
* if the OpenGL extension required for the function we are looking up is supported. */
|
|
|
|
|
|
|
|
/* Check if the extension is part of the GL extension string to see if it is supported. */
|
|
|
|
if(strstr(gl_ext_string, extension) != NULL)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* In general an OpenGL function starts as an ARB/EXT extension and at some stage
|
|
|
|
* it becomes part of the core OpenGL library and can be reached without the ARB/EXT
|
2006-11-07 00:37:42 +01:00
|
|
|
* suffix as well. In the extension table, these functions contain GL_VERSION_major_minor.
|
2006-10-29 22:56:27 +01:00
|
|
|
* Check if we are searching for a core GL function */
|
|
|
|
if(strncmp(extension, "GL_VERSION_", 11) == 0)
|
|
|
|
{
|
|
|
|
const GLubyte *gl_version = glGetString(GL_VERSION);
|
2007-01-24 19:31:56 +01:00
|
|
|
const char *version = extension + 11; /* Move past 'GL_VERSION_' */
|
2006-10-29 22:56:27 +01:00
|
|
|
|
|
|
|
if(!gl_version) {
|
|
|
|
ERR("Error no OpenGL version found,\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compare the major/minor version numbers of the native OpenGL library and what is required by the function.
|
2006-11-07 00:37:42 +01:00
|
|
|
* The gl_version string is guaranteed to have at least a major/minor and sometimes it has a release number as well. */
|
2006-10-29 22:56:27 +01:00
|
|
|
if( (gl_version[0] >= version[0]) || ((gl_version[0] == version[0]) && (gl_version[2] >= version[2])) ) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
WARN("The function requires OpenGL version '%c.%c' while your drivers only provide '%c.%c'\n", version[0], version[2], gl_version[0], gl_version[2]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-11-12 20:23:28 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* wglGetProcAddress (OPENGL32.@)
|
|
|
|
*/
|
2005-12-03 18:01:51 +01:00
|
|
|
PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) {
|
2000-05-12 22:18:14 +02:00
|
|
|
void *local_func;
|
2002-01-02 22:43:19 +01:00
|
|
|
OpenGL_extension ext;
|
2006-06-09 18:13:09 +02:00
|
|
|
const OpenGL_extension *ext_ret;
|
2002-01-02 22:43:19 +01:00
|
|
|
|
2000-05-12 22:18:14 +02:00
|
|
|
TRACE("(%s)\n", lpszProc);
|
|
|
|
|
2006-12-28 23:46:25 +01:00
|
|
|
if(lpszProc == NULL)
|
2006-12-28 01:34:27 +01:00
|
|
|
return NULL;
|
|
|
|
|
2000-05-12 22:18:14 +02:00
|
|
|
/* First, look if it's not already defined in the 'standard' OpenGL functions */
|
2004-02-12 01:35:01 +01:00
|
|
|
if ((local_func = GetProcAddress(opengl32_handle, lpszProc)) != NULL) {
|
2000-05-30 22:04:21 +02:00
|
|
|
TRACE(" found function in 'standard' OpenGL functions (%p)\n", local_func);
|
2000-05-12 22:18:14 +02:00
|
|
|
return local_func;
|
|
|
|
}
|
|
|
|
|
2002-01-02 22:43:19 +01:00
|
|
|
/* After that, search in the thunks to find the real name of the extension */
|
2006-06-09 18:13:09 +02:00
|
|
|
ext.name = lpszProc;
|
2009-04-14 09:55:39 +02:00
|
|
|
ext_ret = bsearch(&ext, extension_registry, extension_registry_size,
|
|
|
|
sizeof(OpenGL_extension), compar);
|
2002-01-02 22:43:19 +01:00
|
|
|
|
2006-12-28 01:34:27 +01:00
|
|
|
/* If nothing was found, we are looking for a WGL extension or an unknown GL extension. */
|
2002-01-02 22:43:19 +01:00
|
|
|
if (ext_ret == NULL) {
|
2006-12-28 01:34:27 +01:00
|
|
|
/* If the function name starts with a w it is a WGL extension */
|
|
|
|
if(lpszProc[0] == 'w')
|
|
|
|
return wine_wgl.p_wglGetProcAddress(lpszProc);
|
|
|
|
|
|
|
|
/* We are dealing with an unknown GL extension. */
|
2006-10-26 23:11:07 +02:00
|
|
|
WARN("Extension '%s' not defined in opengl32.dll's function table!\n", lpszProc);
|
2006-12-28 23:46:25 +01:00
|
|
|
return NULL;
|
2006-09-11 21:28:32 +02:00
|
|
|
} else { /* We are looking for an OpenGL extension */
|
2006-10-29 22:56:27 +01:00
|
|
|
|
|
|
|
/* Check if the GL extension required by the function is available */
|
|
|
|
if(!is_extension_supported(ext_ret->extension)) {
|
|
|
|
WARN("Extension '%s' required by function '%s' not supported!\n", ext_ret->extension, lpszProc);
|
|
|
|
}
|
|
|
|
|
2006-10-26 23:11:07 +02:00
|
|
|
local_func = wine_wgl.p_wglGetProcAddress(ext_ret->name);
|
|
|
|
|
2002-01-02 22:43:19 +01:00
|
|
|
/* After that, look at the extensions defined in the Linux OpenGL library */
|
2003-07-11 05:50:19 +02:00
|
|
|
if (local_func == NULL) {
|
2002-01-02 22:43:19 +01:00
|
|
|
char buf[256];
|
|
|
|
void *ret = NULL;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-01-02 22:43:19 +01:00
|
|
|
/* Remove the 3 last letters (EXT, ARB, ...).
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-01-02 22:43:19 +01:00
|
|
|
I know that some extensions have more than 3 letters (MESA, NV,
|
|
|
|
INTEL, ...), but this is only a stop-gap measure to fix buggy
|
|
|
|
OpenGL drivers (moreover, it is only useful for old 1.0 apps
|
|
|
|
that query the glBindTextureEXT extension).
|
|
|
|
*/
|
2006-10-26 23:11:07 +02:00
|
|
|
memcpy(buf, ext_ret->name, strlen(ext_ret->name) - 3);
|
|
|
|
buf[strlen(ext_ret->name) - 3] = '\0';
|
2002-01-02 22:43:19 +01:00
|
|
|
TRACE(" extension not found in the Linux OpenGL library, checking against libGL bug with %s..\n", buf);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-02-12 01:35:01 +01:00
|
|
|
ret = GetProcAddress(opengl32_handle, buf);
|
2002-01-02 22:43:19 +01:00
|
|
|
if (ret != NULL) {
|
2006-10-26 23:11:07 +02:00
|
|
|
TRACE(" found function in main OpenGL library (%p) !\n", ret);
|
2002-01-02 22:43:19 +01:00
|
|
|
} else {
|
2006-10-26 23:11:07 +02:00
|
|
|
WARN("Did not find function %s (%s) in your OpenGL library !\n", lpszProc, ext_ret->name);
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
|
|
|
|
2002-01-02 22:43:19 +01:00
|
|
|
return ret;
|
2000-05-12 22:18:14 +02:00
|
|
|
} else {
|
2002-01-02 22:43:19 +01:00
|
|
|
TRACE(" returning function (%p)\n", ext_ret->func);
|
2006-06-09 18:13:09 +02:00
|
|
|
extension_funcs[ext_ret - extension_registry] = local_func;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-01-02 22:43:19 +01:00
|
|
|
return ext_ret->func;
|
2000-05-12 22:18:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-18 02:07:53 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* wglRealizeLayerPalette (OPENGL32.@)
|
2000-05-18 02:07:53 +02:00
|
|
|
*/
|
2000-05-12 22:18:14 +02:00
|
|
|
BOOL WINAPI wglRealizeLayerPalette(HDC hdc,
|
|
|
|
int iLayerPlane,
|
|
|
|
BOOL bRealize) {
|
|
|
|
FIXME("()\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-05-18 02:07:53 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* wglSetLayerPaletteEntries (OPENGL32.@)
|
2000-05-18 02:07:53 +02:00
|
|
|
*/
|
2000-05-12 22:18:14 +02:00
|
|
|
int WINAPI wglSetLayerPaletteEntries(HDC hdc,
|
|
|
|
int iLayerPlane,
|
|
|
|
int iStart,
|
|
|
|
int cEntries,
|
|
|
|
const COLORREF *pcr) {
|
|
|
|
FIXME("(): stub !\n");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2000-05-18 02:07:53 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* wglSwapLayerBuffers (OPENGL32.@)
|
2000-05-18 02:07:53 +02:00
|
|
|
*/
|
2000-05-12 22:18:14 +02:00
|
|
|
BOOL WINAPI wglSwapLayerBuffers(HDC hdc,
|
|
|
|
UINT fuPlanes) {
|
2006-03-25 13:07:23 +01:00
|
|
|
TRACE_(opengl)("(%p, %08x)\n", hdc, fuPlanes);
|
2000-05-12 22:18:14 +02:00
|
|
|
|
2002-06-10 04:28:42 +02:00
|
|
|
if (fuPlanes & WGL_SWAP_MAIN_PLANE) {
|
|
|
|
if (!SwapBuffers(hdc)) return FALSE;
|
|
|
|
fuPlanes &= ~WGL_SWAP_MAIN_PLANE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fuPlanes) {
|
|
|
|
WARN("Following layers unhandled : %08x\n", fuPlanes);
|
|
|
|
}
|
2002-07-03 03:16:45 +02:00
|
|
|
|
2002-06-10 04:28:42 +02:00
|
|
|
return TRUE;
|
2000-05-12 22:18:14 +02:00
|
|
|
}
|
|
|
|
|
2008-05-01 13:29:02 +02:00
|
|
|
#ifdef SONAME_LIBGLU
|
2006-03-07 14:55:35 +01:00
|
|
|
|
2008-05-01 14:44:49 +02:00
|
|
|
static void *load_libglu(void)
|
|
|
|
{
|
|
|
|
static int already_loaded;
|
|
|
|
void *handle;
|
|
|
|
|
|
|
|
if (already_loaded) return libglu_handle;
|
|
|
|
already_loaded = 1;
|
|
|
|
|
|
|
|
TRACE("Trying to load GLU library: %s\n", SONAME_LIBGLU);
|
|
|
|
handle = wine_dlopen(SONAME_LIBGLU, RTLD_NOW, NULL, 0);
|
|
|
|
if (!handle)
|
|
|
|
{
|
|
|
|
WARN("Failed to load %s\n", SONAME_LIBGLU);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define LOAD_FUNCPTR(f) if((p##f = (void*)wine_dlsym(handle, #f, NULL, 0)) == NULL) goto sym_not_found;
|
|
|
|
LOAD_FUNCPTR(gluNewTess)
|
|
|
|
LOAD_FUNCPTR(gluDeleteTess)
|
|
|
|
LOAD_FUNCPTR(gluTessBeginContour)
|
|
|
|
LOAD_FUNCPTR(gluTessBeginPolygon)
|
|
|
|
LOAD_FUNCPTR(gluTessCallback)
|
|
|
|
LOAD_FUNCPTR(gluTessEndContour)
|
|
|
|
LOAD_FUNCPTR(gluTessEndPolygon)
|
|
|
|
LOAD_FUNCPTR(gluTessVertex)
|
|
|
|
#undef LOAD_FUNCPTR
|
|
|
|
libglu_handle = handle;
|
|
|
|
return handle;
|
|
|
|
|
|
|
|
sym_not_found:
|
|
|
|
WARN("Unable to load function ptrs from libGLU\n");
|
|
|
|
/* Close the library as we won't use it */
|
|
|
|
wine_dlclose(handle, NULL, 0);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-03-07 14:55:35 +01:00
|
|
|
static void fixed_to_double(POINTFX fixed, UINT em_size, GLdouble vertex[3])
|
|
|
|
{
|
|
|
|
vertex[0] = (fixed.x.value + (GLdouble)fixed.x.fract / (1 << 16)) / em_size;
|
|
|
|
vertex[1] = (fixed.y.value + (GLdouble)fixed.y.fract / (1 << 16)) / em_size;
|
|
|
|
vertex[2] = 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tess_callback_vertex(GLvoid *vertex)
|
|
|
|
{
|
|
|
|
GLdouble *dbl = vertex;
|
|
|
|
TRACE("%f, %f, %f\n", dbl[0], dbl[1], dbl[2]);
|
|
|
|
glVertex3dv(vertex);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tess_callback_begin(GLenum which)
|
|
|
|
{
|
|
|
|
TRACE("%d\n", which);
|
|
|
|
glBegin(which);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tess_callback_end(void)
|
|
|
|
{
|
|
|
|
TRACE("\n");
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* wglUseFontOutlines_common
|
|
|
|
*/
|
2008-11-25 16:42:36 +01:00
|
|
|
static BOOL wglUseFontOutlines_common(HDC hdc,
|
2006-03-07 14:55:35 +01:00
|
|
|
DWORD first,
|
|
|
|
DWORD count,
|
|
|
|
DWORD listBase,
|
|
|
|
FLOAT deviation,
|
|
|
|
FLOAT extrusion,
|
|
|
|
int format,
|
|
|
|
LPGLYPHMETRICSFLOAT lpgmf,
|
|
|
|
BOOL unicode)
|
|
|
|
{
|
|
|
|
UINT glyph;
|
|
|
|
const MAT2 identity = {{0,1},{0,0},{0,0},{0,1}};
|
|
|
|
GLUtesselator *tess;
|
|
|
|
LOGFONTW lf;
|
|
|
|
HFONT old_font, unscaled_font;
|
|
|
|
UINT em_size = 1024;
|
|
|
|
RECT rc;
|
|
|
|
|
2006-10-05 00:58:22 +02:00
|
|
|
TRACE("(%p, %d, %d, %d, %f, %f, %d, %p, %s)\n", hdc, first, count,
|
2006-03-07 14:55:35 +01:00
|
|
|
listBase, deviation, extrusion, format, lpgmf, unicode ? "W" : "A");
|
|
|
|
|
2008-05-01 14:44:49 +02:00
|
|
|
if (!load_libglu())
|
|
|
|
{
|
|
|
|
ERR("libGLU is required for this function but isn't loaded\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2006-03-07 14:55:35 +01:00
|
|
|
|
|
|
|
ENTER_GL();
|
2008-05-01 14:44:49 +02:00
|
|
|
tess = pgluNewTess();
|
2006-03-07 14:55:35 +01:00
|
|
|
if(tess)
|
|
|
|
{
|
2008-05-01 14:44:49 +02:00
|
|
|
pgluTessCallback(tess, GLU_TESS_VERTEX, (_GLUfuncptr)tess_callback_vertex);
|
|
|
|
pgluTessCallback(tess, GLU_TESS_BEGIN, (_GLUfuncptr)tess_callback_begin);
|
|
|
|
pgluTessCallback(tess, GLU_TESS_END, tess_callback_end);
|
2006-03-07 14:55:35 +01:00
|
|
|
}
|
|
|
|
LEAVE_GL();
|
|
|
|
|
|
|
|
if(!tess) return FALSE;
|
|
|
|
|
|
|
|
GetObjectW(GetCurrentObject(hdc, OBJ_FONT), sizeof(lf), &lf);
|
|
|
|
rc.left = rc.right = rc.bottom = 0;
|
|
|
|
rc.top = em_size;
|
|
|
|
DPtoLP(hdc, (POINT*)&rc, 2);
|
|
|
|
lf.lfHeight = -abs(rc.top - rc.bottom);
|
|
|
|
lf.lfOrientation = lf.lfEscapement = 0;
|
|
|
|
unscaled_font = CreateFontIndirectW(&lf);
|
|
|
|
old_font = SelectObject(hdc, unscaled_font);
|
|
|
|
|
|
|
|
for (glyph = first; glyph < first + count; glyph++)
|
|
|
|
{
|
|
|
|
DWORD needed;
|
|
|
|
GLYPHMETRICS gm;
|
|
|
|
BYTE *buf;
|
|
|
|
TTPOLYGONHEADER *pph;
|
|
|
|
TTPOLYCURVE *ppc;
|
|
|
|
GLdouble *vertices;
|
|
|
|
|
|
|
|
if(unicode)
|
|
|
|
needed = GetGlyphOutlineW(hdc, glyph, GGO_NATIVE, &gm, 0, NULL, &identity);
|
|
|
|
else
|
|
|
|
needed = GetGlyphOutlineA(hdc, glyph, GGO_NATIVE, &gm, 0, NULL, &identity);
|
|
|
|
|
|
|
|
if(needed == GDI_ERROR)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
buf = HeapAlloc(GetProcessHeap(), 0, needed);
|
|
|
|
vertices = HeapAlloc(GetProcessHeap(), 0, needed / sizeof(POINTFX) * 3 * sizeof(GLdouble));
|
|
|
|
|
|
|
|
if(unicode)
|
|
|
|
GetGlyphOutlineW(hdc, glyph, GGO_NATIVE, &gm, needed, buf, &identity);
|
|
|
|
else
|
|
|
|
GetGlyphOutlineA(hdc, glyph, GGO_NATIVE, &gm, needed, buf, &identity);
|
|
|
|
|
|
|
|
TRACE("glyph %d\n", glyph);
|
|
|
|
|
|
|
|
if(lpgmf)
|
|
|
|
{
|
2006-06-26 13:12:54 +02:00
|
|
|
lpgmf->gmfBlackBoxX = (float)gm.gmBlackBoxX / em_size;
|
|
|
|
lpgmf->gmfBlackBoxY = (float)gm.gmBlackBoxY / em_size;
|
|
|
|
lpgmf->gmfptGlyphOrigin.x = (float)gm.gmptGlyphOrigin.x / em_size;
|
|
|
|
lpgmf->gmfptGlyphOrigin.y = (float)gm.gmptGlyphOrigin.y / em_size;
|
|
|
|
lpgmf->gmfCellIncX = (float)gm.gmCellIncX / em_size;
|
|
|
|
lpgmf->gmfCellIncY = (float)gm.gmCellIncY / em_size;
|
|
|
|
|
2006-03-07 14:55:35 +01:00
|
|
|
TRACE("%fx%f at %f,%f inc %f,%f\n", lpgmf->gmfBlackBoxX, lpgmf->gmfBlackBoxY,
|
|
|
|
lpgmf->gmfptGlyphOrigin.x, lpgmf->gmfptGlyphOrigin.y, lpgmf->gmfCellIncX, lpgmf->gmfCellIncY);
|
|
|
|
lpgmf++;
|
|
|
|
}
|
|
|
|
|
|
|
|
ENTER_GL();
|
|
|
|
glNewList(listBase++, GL_COMPILE);
|
2008-05-01 14:44:49 +02:00
|
|
|
pgluTessBeginPolygon(tess, NULL);
|
2006-03-07 14:55:35 +01:00
|
|
|
|
|
|
|
pph = (TTPOLYGONHEADER*)buf;
|
|
|
|
while((BYTE*)pph < buf + needed)
|
|
|
|
{
|
|
|
|
TRACE("\tstart %d, %d\n", pph->pfxStart.x.value, pph->pfxStart.y.value);
|
|
|
|
|
2008-05-01 14:44:49 +02:00
|
|
|
pgluTessBeginContour(tess);
|
2006-03-07 14:55:35 +01:00
|
|
|
|
|
|
|
fixed_to_double(pph->pfxStart, em_size, vertices);
|
2008-05-01 14:44:49 +02:00
|
|
|
pgluTessVertex(tess, vertices, vertices);
|
2006-03-07 14:55:35 +01:00
|
|
|
vertices += 3;
|
|
|
|
|
|
|
|
ppc = (TTPOLYCURVE*)((char*)pph + sizeof(*pph));
|
|
|
|
while((char*)ppc < (char*)pph + pph->cb)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
switch(ppc->wType) {
|
|
|
|
case TT_PRIM_LINE:
|
|
|
|
for(i = 0; i < ppc->cpfx; i++)
|
|
|
|
{
|
|
|
|
TRACE("\t\tline to %d, %d\n", ppc->apfx[i].x.value, ppc->apfx[i].y.value);
|
|
|
|
fixed_to_double(ppc->apfx[i], em_size, vertices);
|
2008-05-01 14:44:49 +02:00
|
|
|
pgluTessVertex(tess, vertices, vertices);
|
2006-03-07 14:55:35 +01:00
|
|
|
vertices += 3;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TT_PRIM_QSPLINE:
|
|
|
|
for(i = 0; i < ppc->cpfx/2; i++)
|
|
|
|
{
|
|
|
|
/* FIXME just connecting the control points for now */
|
|
|
|
TRACE("\t\tcurve %d,%d %d,%d\n",
|
|
|
|
ppc->apfx[i * 2].x.value, ppc->apfx[i * 3].y.value,
|
|
|
|
ppc->apfx[i * 2 + 1].x.value, ppc->apfx[i * 3 + 1].y.value);
|
|
|
|
fixed_to_double(ppc->apfx[i * 2], em_size, vertices);
|
2008-05-01 14:44:49 +02:00
|
|
|
pgluTessVertex(tess, vertices, vertices);
|
2006-03-07 14:55:35 +01:00
|
|
|
vertices += 3;
|
|
|
|
fixed_to_double(ppc->apfx[i * 2 + 1], em_size, vertices);
|
2008-05-01 14:44:49 +02:00
|
|
|
pgluTessVertex(tess, vertices, vertices);
|
2006-03-07 14:55:35 +01:00
|
|
|
vertices += 3;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ERR("\t\tcurve type = %d\n", ppc->wType);
|
2008-05-01 14:44:49 +02:00
|
|
|
pgluTessEndContour(tess);
|
2006-03-07 14:55:35 +01:00
|
|
|
goto error_in_list;
|
|
|
|
}
|
|
|
|
|
|
|
|
ppc = (TTPOLYCURVE*)((char*)ppc + sizeof(*ppc) +
|
|
|
|
(ppc->cpfx - 1) * sizeof(POINTFX));
|
|
|
|
}
|
2008-05-01 14:44:49 +02:00
|
|
|
pgluTessEndContour(tess);
|
2006-03-07 14:55:35 +01:00
|
|
|
pph = (TTPOLYGONHEADER*)((char*)pph + pph->cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
error_in_list:
|
2008-05-01 14:44:49 +02:00
|
|
|
pgluTessEndPolygon(tess);
|
2006-06-26 13:12:54 +02:00
|
|
|
glTranslated((GLdouble)gm.gmCellIncX / em_size, (GLdouble)gm.gmCellIncY / em_size, 0.0);
|
2006-03-07 14:55:35 +01:00
|
|
|
glEndList();
|
|
|
|
LEAVE_GL();
|
|
|
|
HeapFree(GetProcessHeap(), 0, buf);
|
|
|
|
HeapFree(GetProcessHeap(), 0, vertices);
|
|
|
|
}
|
|
|
|
|
|
|
|
error:
|
|
|
|
DeleteObject(SelectObject(hdc, old_font));
|
2008-05-01 14:44:49 +02:00
|
|
|
pgluDeleteTess(tess);
|
2006-03-07 14:55:35 +01:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-05-01 13:29:02 +02:00
|
|
|
#else /* SONAME_LIBGLU */
|
2006-03-07 14:55:35 +01:00
|
|
|
|
2008-11-25 16:42:36 +01:00
|
|
|
static BOOL wglUseFontOutlines_common(HDC hdc,
|
2006-03-07 14:55:35 +01:00
|
|
|
DWORD first,
|
|
|
|
DWORD count,
|
|
|
|
DWORD listBase,
|
|
|
|
FLOAT deviation,
|
|
|
|
FLOAT extrusion,
|
|
|
|
int format,
|
|
|
|
LPGLYPHMETRICSFLOAT lpgmf,
|
|
|
|
BOOL unicode)
|
|
|
|
{
|
|
|
|
FIXME("Unable to compile in wglUseFontOutlines support without GL/glu.h\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-05-01 13:29:02 +02:00
|
|
|
#endif /* SONAME_LIBGLU */
|
2006-03-07 14:55:35 +01:00
|
|
|
|
2000-05-18 02:07:53 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* wglUseFontOutlinesA (OPENGL32.@)
|
2000-05-18 02:07:53 +02:00
|
|
|
*/
|
2000-05-23 03:20:08 +02:00
|
|
|
BOOL WINAPI wglUseFontOutlinesA(HDC hdc,
|
|
|
|
DWORD first,
|
|
|
|
DWORD count,
|
|
|
|
DWORD listBase,
|
|
|
|
FLOAT deviation,
|
|
|
|
FLOAT extrusion,
|
|
|
|
int format,
|
2006-03-07 14:55:35 +01:00
|
|
|
LPGLYPHMETRICSFLOAT lpgmf)
|
|
|
|
{
|
|
|
|
return wglUseFontOutlines_common(hdc, first, count, listBase, deviation, extrusion, format, lpgmf, FALSE);
|
|
|
|
}
|
2000-05-12 22:18:14 +02:00
|
|
|
|
2006-03-07 14:55:35 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* wglUseFontOutlinesW (OPENGL32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI wglUseFontOutlinesW(HDC hdc,
|
|
|
|
DWORD first,
|
|
|
|
DWORD count,
|
|
|
|
DWORD listBase,
|
|
|
|
FLOAT deviation,
|
|
|
|
FLOAT extrusion,
|
|
|
|
int format,
|
|
|
|
LPGLYPHMETRICSFLOAT lpgmf)
|
|
|
|
{
|
|
|
|
return wglUseFontOutlines_common(hdc, first, count, listBase, deviation, extrusion, format, lpgmf, TRUE);
|
2000-05-12 22:18:14 +02:00
|
|
|
}
|
|
|
|
|
2007-09-23 05:45:27 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* glFinish (OPENGL32.@)
|
|
|
|
*/
|
|
|
|
void WINAPI wine_glFinish( void )
|
|
|
|
{
|
|
|
|
TRACE("()\n");
|
|
|
|
wine_wgl.p_wglFinish();
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* glFlush (OPENGL32.@)
|
|
|
|
*/
|
|
|
|
void WINAPI wine_glFlush( void )
|
|
|
|
{
|
|
|
|
TRACE("()\n");
|
|
|
|
wine_wgl.p_wglFlush();
|
|
|
|
}
|
|
|
|
|
2006-12-12 17:59:44 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* glGetString (OPENGL32.@)
|
|
|
|
*/
|
|
|
|
const GLubyte * WINAPI wine_glGetString( GLenum name )
|
|
|
|
{
|
|
|
|
const GLubyte *ret;
|
2005-04-28 20:31:15 +02:00
|
|
|
const char* GL_Extensions = NULL;
|
2006-12-07 16:45:58 +01:00
|
|
|
|
2008-07-02 16:51:26 +02:00
|
|
|
/* this is for buggy nvidia driver, crashing if called from a different
|
|
|
|
thread with no context */
|
|
|
|
if(wglGetCurrentContext() == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
2005-04-28 20:31:15 +02:00
|
|
|
if (GL_EXTENSIONS != name) {
|
2006-12-12 17:59:44 +01:00
|
|
|
ENTER_GL();
|
|
|
|
ret = glGetString(name);
|
|
|
|
LEAVE_GL();
|
|
|
|
return ret;
|
2005-04-28 20:31:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL == internal_gl_extensions) {
|
2006-12-12 17:59:44 +01:00
|
|
|
ENTER_GL();
|
2005-08-10 11:48:58 +02:00
|
|
|
GL_Extensions = (const char *) glGetString(GL_EXTENSIONS);
|
2005-04-28 20:31:15 +02:00
|
|
|
|
2006-12-12 17:59:44 +01:00
|
|
|
if (GL_Extensions)
|
|
|
|
{
|
2005-04-28 20:31:15 +02:00
|
|
|
size_t len = strlen(GL_Extensions);
|
2005-05-10 15:15:12 +02:00
|
|
|
internal_gl_extensions = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len + 2);
|
2005-04-28 20:31:15 +02:00
|
|
|
|
2006-12-12 17:59:44 +01:00
|
|
|
TRACE("GL_EXTENSIONS reported:\n");
|
2005-04-28 20:31:15 +02:00
|
|
|
while (*GL_Extensions != 0x00) {
|
|
|
|
const char* Start = GL_Extensions;
|
|
|
|
char ThisExtn[256];
|
2006-12-12 17:59:44 +01:00
|
|
|
|
2005-04-28 20:31:15 +02:00
|
|
|
while (*GL_Extensions != ' ' && *GL_Extensions != 0x00) {
|
|
|
|
GL_Extensions++;
|
|
|
|
}
|
|
|
|
memcpy(ThisExtn, Start, (GL_Extensions - Start));
|
2006-12-12 17:59:44 +01:00
|
|
|
ThisExtn[GL_Extensions - Start] = 0;
|
2005-04-28 20:31:15 +02:00
|
|
|
TRACE("- %s:", ThisExtn);
|
|
|
|
|
|
|
|
/* test if supported API is disabled by config */
|
2008-03-24 01:15:31 +01:00
|
|
|
if (!internal_gl_disabled_extensions || !strstr(internal_gl_disabled_extensions, ThisExtn)) {
|
2005-04-28 20:31:15 +02:00
|
|
|
strcat(internal_gl_extensions, " ");
|
2005-05-10 15:15:12 +02:00
|
|
|
strcat(internal_gl_extensions, ThisExtn);
|
2005-04-28 20:31:15 +02:00
|
|
|
TRACE(" active\n");
|
|
|
|
} else {
|
|
|
|
TRACE(" deactived (by config)\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*GL_Extensions == ' ') GL_Extensions++;
|
|
|
|
}
|
|
|
|
}
|
2006-12-12 17:59:44 +01:00
|
|
|
LEAVE_GL();
|
2005-04-28 20:31:15 +02:00
|
|
|
}
|
2005-08-10 11:48:58 +02:00
|
|
|
return (const GLubyte *) internal_gl_extensions;
|
2005-04-28 20:31:15 +02:00
|
|
|
}
|
|
|
|
|
2006-12-12 17:59:44 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* glGetIntegerv (OPENGL32.@)
|
|
|
|
*/
|
|
|
|
void WINAPI wine_glGetIntegerv( GLenum pname, GLint* params )
|
|
|
|
{
|
|
|
|
wine_wgl.p_wglGetIntegerv(pname, params);
|
2005-11-11 11:52:14 +01:00
|
|
|
}
|
|
|
|
|
2009-10-14 23:20:20 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* wglSwapBuffers (OPENGL32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DECLSPEC_HOTPATCH wglSwapBuffers( HDC hdc )
|
|
|
|
{
|
|
|
|
return SwapBuffers(hdc);
|
|
|
|
}
|
2005-04-28 20:31:15 +02:00
|
|
|
|
2000-05-12 22:18:14 +02:00
|
|
|
/* This is for brain-dead applications that use OpenGL functions before even
|
|
|
|
creating a rendering context.... */
|
2002-03-23 22:43:56 +01:00
|
|
|
static BOOL process_attach(void)
|
|
|
|
{
|
2006-11-10 12:37:04 +01:00
|
|
|
HMODULE mod_x11, mod_gdi32;
|
2008-03-24 01:15:31 +01:00
|
|
|
DWORD size;
|
2005-04-28 20:31:15 +02:00
|
|
|
HKEY hkey = 0;
|
2003-12-05 05:43:20 +01:00
|
|
|
|
2006-11-10 12:37:04 +01:00
|
|
|
GetDesktopWindow(); /* make sure winex11 is loaded (FIXME) */
|
|
|
|
mod_x11 = GetModuleHandleA( "winex11.drv" );
|
|
|
|
mod_gdi32 = GetModuleHandleA( "gdi32.dll" );
|
|
|
|
|
|
|
|
if (!mod_x11 || !mod_gdi32)
|
2001-06-26 23:10:11 +02:00
|
|
|
{
|
2006-10-26 23:11:07 +02:00
|
|
|
ERR("X11DRV or GDI32 not loaded. Cannot create default context.\n");
|
2002-03-23 22:43:56 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-11-10 12:37:04 +01:00
|
|
|
wine_tsx11_lock_ptr = (void *)GetProcAddress( mod_x11, "wine_tsx11_lock" );
|
|
|
|
wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod_x11, "wine_tsx11_unlock" );
|
2002-09-25 02:29:56 +02:00
|
|
|
|
2006-10-26 23:11:07 +02:00
|
|
|
wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod_gdi32, "wglGetProcAddress");
|
2006-09-20 23:23:17 +02:00
|
|
|
|
2006-08-29 16:58:49 +02:00
|
|
|
/* Interal WGL function */
|
2006-10-26 23:11:07 +02:00
|
|
|
wine_wgl.p_wglGetIntegerv = (void *)wine_wgl.p_wglGetProcAddress("wglGetIntegerv");
|
2007-09-23 05:45:27 +02:00
|
|
|
wine_wgl.p_wglFinish = (void *)wine_wgl.p_wglGetProcAddress("wglFinish");
|
|
|
|
wine_wgl.p_wglFlush = (void *)wine_wgl.p_wglGetProcAddress("wglFlush");
|
2006-08-29 16:56:57 +02:00
|
|
|
|
2006-11-04 22:28:41 +01:00
|
|
|
if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\OpenGL", &hkey)) {
|
2008-03-24 01:15:31 +01:00
|
|
|
if (!RegQueryValueExA( hkey, "DisabledExtensions", 0, NULL, NULL, &size)) {
|
|
|
|
internal_gl_disabled_extensions = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
|
|
|
|
RegQueryValueExA( hkey, "DisabledExtensions", 0, NULL, (LPBYTE)internal_gl_disabled_extensions, &size);
|
|
|
|
TRACE("found DisabledExtensions=%s\n", debugstr_a(internal_gl_disabled_extensions));
|
2005-04-28 20:31:15 +02:00
|
|
|
}
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
}
|
|
|
|
|
2002-03-23 22:43:56 +01:00
|
|
|
return TRUE;
|
2000-05-12 22:18:14 +02:00
|
|
|
}
|
2000-06-12 23:53:46 +02:00
|
|
|
|
2003-03-06 23:48:54 +01:00
|
|
|
|
2003-08-08 23:07:23 +02:00
|
|
|
/**********************************************************************/
|
|
|
|
|
2002-03-23 22:43:56 +01:00
|
|
|
static void process_detach(void)
|
|
|
|
{
|
2008-05-01 14:44:49 +02:00
|
|
|
if (libglu_handle) wine_dlclose(libglu_handle, NULL, 0);
|
2006-05-10 00:33:53 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, internal_gl_extensions);
|
2008-03-24 01:15:31 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, internal_gl_disabled_extensions);
|
2003-05-07 05:18:51 +02:00
|
|
|
}
|
|
|
|
|
2000-06-12 23:53:46 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* OpenGL initialisation routine
|
|
|
|
*/
|
2002-11-05 00:53:41 +01:00
|
|
|
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
|
2000-06-12 23:53:46 +02:00
|
|
|
{
|
2002-03-23 22:43:56 +01:00
|
|
|
switch(reason)
|
|
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
2004-02-12 01:35:01 +01:00
|
|
|
opengl32_handle = hinst;
|
2003-06-30 22:53:48 +02:00
|
|
|
DisableThreadLibraryCalls(hinst);
|
2002-03-23 22:43:56 +01:00
|
|
|
return process_attach();
|
|
|
|
case DLL_PROCESS_DETACH:
|
|
|
|
process_detach();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
2000-06-12 23:53:46 +02:00
|
|
|
}
|