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
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
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"
|
2000-05-23 23:15:06 +02:00
|
|
|
#include "winerror.h"
|
2000-05-12 22:18:14 +02:00
|
|
|
|
|
|
|
#include "wgl.h"
|
|
|
|
#include "opengl_ext.h"
|
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
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(opengl);
|
2000-05-12 22:18:14 +02:00
|
|
|
|
2003-04-22 06:05:08 +02:00
|
|
|
/* x11drv GDI escapes */
|
|
|
|
#define X11DRV_ESCAPE 6789
|
|
|
|
enum x11drv_escape_codes
|
|
|
|
{
|
|
|
|
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 */
|
|
|
|
};
|
|
|
|
|
2002-09-25 02:29:56 +02:00
|
|
|
void (*wine_tsx11_lock_ptr)(void) = NULL;
|
|
|
|
void (*wine_tsx11_unlock_ptr)(void) = NULL;
|
|
|
|
|
2000-06-12 23:53:46 +02:00
|
|
|
static GLXContext default_cx = NULL;
|
2002-03-23 22:43:56 +01:00
|
|
|
static Display *default_display; /* display to use for default context */
|
2000-06-12 23:53:46 +02:00
|
|
|
|
2003-07-11 05:50:19 +02:00
|
|
|
static void *(*p_glXGetProcAddressARB)(const GLubyte *);
|
|
|
|
|
2000-05-30 22:04:21 +02:00
|
|
|
typedef struct wine_glcontext {
|
|
|
|
HDC hdc;
|
2002-03-23 22:43:56 +01:00
|
|
|
Display *display;
|
2000-05-30 22:04:21 +02:00
|
|
|
GLXContext ctx;
|
|
|
|
XVisualInfo *vis;
|
|
|
|
struct wine_glcontext *next;
|
|
|
|
struct wine_glcontext *prev;
|
|
|
|
} Wine_GLContext;
|
2002-03-23 22:43:56 +01:00
|
|
|
static Wine_GLContext *context_list;
|
2000-05-30 22:04:21 +02:00
|
|
|
|
2002-03-23 22:43:56 +01:00
|
|
|
static inline Wine_GLContext *get_context_from_GLXContext(GLXContext ctx)
|
|
|
|
{
|
|
|
|
Wine_GLContext *ret;
|
|
|
|
for (ret = context_list; ret; ret = ret->next) if (ctx == ret->ctx) break;
|
|
|
|
return ret;
|
2000-05-30 22:04:21 +02:00
|
|
|
}
|
2002-03-23 22:43:56 +01:00
|
|
|
|
|
|
|
static inline void free_context(Wine_GLContext *context)
|
|
|
|
{
|
2000-05-30 22:04:21 +02:00
|
|
|
if (context->next != NULL) context->next->prev = context->prev;
|
|
|
|
if (context->prev != NULL) context->prev->next = context->next;
|
2002-03-23 22:43:56 +01:00
|
|
|
else context_list = context->next;
|
2000-05-30 22:04:21 +02:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, context);
|
|
|
|
}
|
|
|
|
|
2002-03-23 22:43:56 +01:00
|
|
|
static inline Wine_GLContext *alloc_context(void)
|
|
|
|
{
|
2000-05-30 22:04:21 +02:00
|
|
|
Wine_GLContext *ret;
|
|
|
|
|
2002-03-23 22:43:56 +01:00
|
|
|
if ((ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Wine_GLContext))))
|
|
|
|
{
|
|
|
|
ret->next = context_list;
|
|
|
|
if (context_list) context_list->prev = ret;
|
|
|
|
context_list = ret;
|
|
|
|
}
|
2000-05-30 22:04:21 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2002-03-23 22:43:56 +01:00
|
|
|
inline static BOOL is_valid_context( Wine_GLContext *ctx )
|
|
|
|
{
|
|
|
|
Wine_GLContext *ptr;
|
|
|
|
for (ptr = context_list; ptr; ptr = ptr->next) if (ptr == ctx) break;
|
|
|
|
return (ptr != NULL);
|
|
|
|
}
|
2000-05-30 22:04:21 +02:00
|
|
|
|
2002-03-23 22:43:56 +01:00
|
|
|
/* retrieve the X display to use on a given DC */
|
|
|
|
inline static Display *get_display( HDC hdc )
|
|
|
|
{
|
|
|
|
Display *display;
|
|
|
|
enum x11drv_escape_codes escape = X11DRV_GET_DISPLAY;
|
|
|
|
|
|
|
|
if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
|
|
|
|
sizeof(display), (LPSTR)&display )) display = NULL;
|
|
|
|
return display;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* retrieve the X drawable to use on a given DC */
|
|
|
|
inline static Drawable get_drawable( HDC hdc )
|
|
|
|
{
|
|
|
|
Drawable drawable;
|
|
|
|
enum x11drv_escape_codes escape = X11DRV_GET_DRAWABLE;
|
|
|
|
|
|
|
|
if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
|
|
|
|
sizeof(drawable), (LPSTR)&drawable )) drawable = 0;
|
|
|
|
return drawable;
|
2000-05-23 23:15:06 +02:00
|
|
|
}
|
2002-03-23 22:43:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* retrieve the X drawable to use on a given DC */
|
|
|
|
inline static Font get_font( HDC hdc )
|
2000-05-23 23:15:06 +02:00
|
|
|
{
|
2002-03-23 22:43:56 +01:00
|
|
|
Font font;
|
|
|
|
enum x11drv_escape_codes escape = X11DRV_GET_FONT;
|
|
|
|
|
|
|
|
if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
|
|
|
|
sizeof(font), (LPSTR)&font )) font = 0;
|
|
|
|
return font;
|
2000-05-23 23:15:06 +02:00
|
|
|
}
|
|
|
|
|
2002-03-23 22:43:56 +01:00
|
|
|
|
2000-05-18 02:07:53 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* wglCreateContext (OPENGL32.@)
|
2000-05-18 02:07:53 +02:00
|
|
|
*/
|
2001-04-25 01:17:53 +02:00
|
|
|
HGLRC WINAPI wglCreateContext(HDC hdc)
|
|
|
|
{
|
2000-05-12 22:18:14 +02:00
|
|
|
XVisualInfo *vis;
|
2000-05-30 22:04:21 +02:00
|
|
|
Wine_GLContext *ret;
|
2001-03-28 03:45:08 +02:00
|
|
|
int num;
|
|
|
|
XVisualInfo template;
|
2002-03-23 22:43:56 +01:00
|
|
|
Display *display = get_display( hdc );
|
2000-05-12 22:18:14 +02:00
|
|
|
|
2002-10-19 01:48:57 +02:00
|
|
|
TRACE("(%p)\n", hdc);
|
2000-05-12 22:18:14 +02:00
|
|
|
|
2001-03-28 03:45:08 +02:00
|
|
|
/* First, get the visual in use by the X11DRV */
|
2002-03-23 22:43:56 +01:00
|
|
|
if (!display) return 0;
|
2002-10-19 01:48:57 +02:00
|
|
|
template.visualid = (VisualID)GetPropA( GetDesktopWindow(), "__wine_x11_visual_id" );
|
2002-03-23 22:43:56 +01:00
|
|
|
vis = XGetVisualInfo(display, VisualIDMask, &template, &num);
|
2000-05-12 22:18:14 +02:00
|
|
|
|
|
|
|
if (vis == NULL) {
|
|
|
|
ERR("NULL visual !!!\n");
|
|
|
|
/* Need to set errors here */
|
|
|
|
return NULL;
|
|
|
|
}
|
2000-05-30 22:04:21 +02:00
|
|
|
|
|
|
|
/* The context will be allocated in the wglMakeCurrent call */
|
2000-05-12 22:18:14 +02:00
|
|
|
ENTER_GL();
|
2000-05-30 22:04:21 +02:00
|
|
|
ret = alloc_context();
|
2000-05-12 22:18:14 +02:00
|
|
|
LEAVE_GL();
|
2000-05-30 22:04:21 +02:00
|
|
|
ret->hdc = hdc;
|
2002-03-23 22:43:56 +01:00
|
|
|
ret->display = display;
|
2000-05-30 22:04:21 +02:00
|
|
|
ret->vis = vis;
|
2000-05-12 22:18:14 +02:00
|
|
|
|
2000-05-30 22:04:21 +02:00
|
|
|
TRACE(" creating context %p (GL context creation delayed)\n", ret);
|
2000-05-12 22:18:14 +02:00
|
|
|
return (HGLRC) ret;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
* wglCopyContext (OPENGL32.@)
|
2000-05-18 02:07:53 +02:00
|
|
|
*/
|
2000-05-12 22:18:14 +02:00
|
|
|
BOOL WINAPI wglCopyContext(HGLRC hglrcSrc,
|
|
|
|
HGLRC hglrcDst,
|
|
|
|
UINT mask) {
|
|
|
|
FIXME("(%p,%p,%d)\n", hglrcSrc, hglrcDst, mask);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-05-18 02:07:53 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* wglDeleteContext (OPENGL32.@)
|
2000-05-18 02:07:53 +02:00
|
|
|
*/
|
2002-03-23 22:43:56 +01:00
|
|
|
BOOL WINAPI wglDeleteContext(HGLRC hglrc)
|
|
|
|
{
|
2000-05-30 22:04:21 +02:00
|
|
|
Wine_GLContext *ctx = (Wine_GLContext *) hglrc;
|
2002-03-23 22:43:56 +01:00
|
|
|
BOOL ret = TRUE;
|
|
|
|
|
2000-05-23 03:20:08 +02:00
|
|
|
TRACE("(%p)\n", hglrc);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-05-23 03:20:08 +02:00
|
|
|
ENTER_GL();
|
2002-03-23 22:43:56 +01:00
|
|
|
/* A game (Half Life not to name it) deletes twice the same context,
|
|
|
|
* so make sure it is valid first */
|
|
|
|
if (is_valid_context( ctx ))
|
|
|
|
{
|
|
|
|
if (ctx->ctx) glXDestroyContext(ctx->display, ctx->ctx);
|
|
|
|
free_context(ctx);
|
2000-05-23 23:15:06 +02:00
|
|
|
}
|
2002-03-23 22:43:56 +01:00
|
|
|
else
|
|
|
|
{
|
2000-05-30 22:04:21 +02:00
|
|
|
WARN("Error deleting context !\n");
|
2000-05-23 23:15:06 +02:00
|
|
|
SetLastError(ERROR_INVALID_HANDLE);
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
2000-05-23 03:20:08 +02:00
|
|
|
LEAVE_GL();
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-05-23 23:15:06 +02:00
|
|
|
return ret;
|
2000-05-12 22:18:14 +02:00
|
|
|
}
|
|
|
|
|
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
|
|
|
* wglGetCurrentContext (OPENGL32.@)
|
2000-05-18 02:07:53 +02:00
|
|
|
*/
|
2000-05-12 22:18:14 +02:00
|
|
|
HGLRC WINAPI wglGetCurrentContext(void) {
|
2000-05-30 22:04:21 +02:00
|
|
|
GLXContext gl_ctx;
|
|
|
|
Wine_GLContext *ret;
|
2000-05-12 22:18:14 +02:00
|
|
|
|
|
|
|
TRACE("()\n");
|
|
|
|
|
|
|
|
ENTER_GL();
|
2000-05-30 22:04:21 +02:00
|
|
|
gl_ctx = glXGetCurrentContext();
|
|
|
|
ret = get_context_from_GLXContext(gl_ctx);
|
2000-05-12 22:18:14 +02:00
|
|
|
LEAVE_GL();
|
|
|
|
|
2000-05-30 22:04:21 +02:00
|
|
|
TRACE(" returning %p (GL context %p)\n", ret, gl_ctx);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-05-12 22:18:14 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2000-05-18 02:07:53 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* wglGetCurrentDC (OPENGL32.@)
|
2000-05-18 02:07:53 +02:00
|
|
|
*/
|
2000-05-12 22:18:14 +02:00
|
|
|
HDC WINAPI wglGetCurrentDC(void) {
|
2000-05-30 22:04:21 +02:00
|
|
|
GLXContext gl_ctx;
|
|
|
|
Wine_GLContext *ret;
|
2000-05-12 22:18:14 +02:00
|
|
|
|
2000-05-30 22:04:21 +02:00
|
|
|
TRACE("()\n");
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-05-12 22:18:14 +02:00
|
|
|
ENTER_GL();
|
2000-05-30 22:04:21 +02:00
|
|
|
gl_ctx = glXGetCurrentContext();
|
|
|
|
ret = get_context_from_GLXContext(gl_ctx);
|
2000-05-12 22:18:14 +02:00
|
|
|
LEAVE_GL();
|
|
|
|
|
2000-05-30 22:04:21 +02:00
|
|
|
if (ret) {
|
2002-10-19 01:48:57 +02:00
|
|
|
TRACE(" returning %p (GL context %p - Wine context %p)\n", ret->hdc, gl_ctx, ret);
|
2000-05-30 22:04:21 +02:00
|
|
|
return ret->hdc;
|
2000-05-12 22:18:14 +02:00
|
|
|
} else {
|
2000-05-30 22:04:21 +02:00
|
|
|
TRACE(" no Wine context found for GLX context %p\n", gl_ctx);
|
2000-05-12 22:18:14 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2002-01-02 22:43:19 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* wglGetProcAddress (OPENGL32.@)
|
|
|
|
*/
|
2000-05-12 22:18:14 +02:00
|
|
|
static int compar(const void *elt_a, const void *elt_b) {
|
|
|
|
return strcmp(((OpenGL_extension *) elt_a)->name,
|
|
|
|
((OpenGL_extension *) elt_b)->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void* WINAPI wglGetProcAddress(LPCSTR lpszProc) {
|
|
|
|
void *local_func;
|
|
|
|
static HMODULE hm = 0;
|
2002-01-02 22:43:19 +01:00
|
|
|
OpenGL_extension ext;
|
|
|
|
OpenGL_extension *ext_ret;
|
|
|
|
|
2000-05-12 22:18:14 +02:00
|
|
|
|
|
|
|
TRACE("(%s)\n", lpszProc);
|
|
|
|
|
|
|
|
if (hm == 0)
|
|
|
|
hm = GetModuleHandleA("opengl32");
|
|
|
|
|
|
|
|
/* First, look if it's not already defined in the 'standard' OpenGL functions */
|
|
|
|
if ((local_func = GetProcAddress(hm, 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;
|
|
|
|
}
|
|
|
|
|
2003-07-11 05:50:19 +02:00
|
|
|
if (p_glXGetProcAddressARB == NULL) {
|
2003-09-17 22:04:25 +02:00
|
|
|
ERR("Warning : dynamic GL extension loading not supported by native GL library.\n");
|
2003-07-11 05:50:19 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-01-02 22:43:19 +01:00
|
|
|
/* After that, search in the thunks to find the real name of the extension */
|
|
|
|
ext.name = (char *) lpszProc;
|
|
|
|
ext_ret = (OpenGL_extension *) bsearch(&ext, extension_registry,
|
|
|
|
extension_registry_size, sizeof(OpenGL_extension), compar);
|
|
|
|
|
|
|
|
if (ext_ret == NULL) {
|
|
|
|
/* Some sanity checks :-) */
|
2003-07-11 05:50:19 +02:00
|
|
|
ENTER_GL();
|
|
|
|
local_func = p_glXGetProcAddressARB(lpszProc);
|
|
|
|
LEAVE_GL();
|
|
|
|
if (local_func != NULL) {
|
2002-01-02 22:43:19 +01:00
|
|
|
ERR("Extension %s defined in the OpenGL library but NOT in opengl_ext.c... Please report (lionel.ulmer@free.fr) !\n", lpszProc);
|
|
|
|
return NULL;
|
2000-05-12 22:18:14 +02:00
|
|
|
}
|
|
|
|
|
2002-01-02 22:43:19 +01:00
|
|
|
WARN("Did not find extension %s in either Wine or your OpenGL library.\n", lpszProc);
|
|
|
|
return NULL;
|
2000-05-12 22:18:14 +02:00
|
|
|
} else {
|
2003-07-11 05:50:19 +02:00
|
|
|
ENTER_GL();
|
|
|
|
local_func = p_glXGetProcAddressARB(ext_ret->glx_name);
|
|
|
|
LEAVE_GL();
|
|
|
|
|
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).
|
|
|
|
*/
|
|
|
|
strncpy(buf, ext_ret->glx_name, strlen(ext_ret->glx_name) - 3);
|
|
|
|
buf[strlen(ext_ret->glx_name) - 3] = '\0';
|
|
|
|
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
|
|
|
|
2002-01-02 22:43:19 +01:00
|
|
|
ret = GetProcAddress(hm, buf);
|
|
|
|
if (ret != NULL) {
|
|
|
|
TRACE(" found function in main OpenGL library (%p) !\n", ret);
|
|
|
|
} else {
|
|
|
|
WARN("Did not find function %s (%s) in your OpenGL library !\n", lpszProc, ext_ret->glx_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);
|
|
|
|
*(ext_ret->func_ptr) = 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
|
|
|
* wglMakeCurrent (OPENGL32.@)
|
2000-05-18 02:07:53 +02:00
|
|
|
*/
|
2000-05-12 22:18:14 +02:00
|
|
|
BOOL WINAPI wglMakeCurrent(HDC hdc,
|
|
|
|
HGLRC hglrc) {
|
|
|
|
BOOL ret;
|
|
|
|
|
2002-10-19 01:48:57 +02:00
|
|
|
TRACE("(%p,%p)\n", hdc, hglrc);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-03-23 22:43:56 +01:00
|
|
|
ENTER_GL();
|
2000-05-23 23:15:06 +02:00
|
|
|
if (hglrc == NULL) {
|
2002-03-23 22:43:56 +01:00
|
|
|
ret = glXMakeCurrent(default_display, None, NULL);
|
2000-05-23 23:15:06 +02:00
|
|
|
} else {
|
2000-05-30 22:04:21 +02:00
|
|
|
Wine_GLContext *ctx = (Wine_GLContext *) hglrc;
|
2002-03-23 22:43:56 +01:00
|
|
|
Drawable drawable = get_drawable( hdc );
|
2000-05-30 22:04:21 +02:00
|
|
|
|
|
|
|
if (ctx->ctx == NULL) {
|
2002-03-23 22:43:56 +01:00
|
|
|
ctx->ctx = glXCreateContext(ctx->display, ctx->vis, NULL, True);
|
2000-05-30 22:04:21 +02:00
|
|
|
TRACE(" created a delayed OpenGL context (%p)\n", ctx->ctx);
|
|
|
|
}
|
2002-03-23 22:43:56 +01:00
|
|
|
ret = glXMakeCurrent(ctx->display, drawable, ctx->ctx);
|
2000-05-23 23:15:06 +02:00
|
|
|
}
|
2002-03-23 22:43:56 +01:00
|
|
|
LEAVE_GL();
|
2000-05-30 22:04:21 +02:00
|
|
|
TRACE(" returning %s\n", (ret ? "True" : "False"));
|
2000-05-12 22:18:14 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
* wglShareLists (OPENGL32.@)
|
2000-05-18 02:07:53 +02:00
|
|
|
*/
|
2000-05-12 22:18:14 +02:00
|
|
|
BOOL WINAPI wglShareLists(HGLRC hglrc1,
|
|
|
|
HGLRC hglrc2) {
|
2000-05-30 22:04:21 +02:00
|
|
|
Wine_GLContext *org = (Wine_GLContext *) hglrc1;
|
|
|
|
Wine_GLContext *dest = (Wine_GLContext *) hglrc2;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-05-30 22:04:21 +02:00
|
|
|
TRACE("(%p, %p)\n", org, dest);
|
2000-05-12 22:18:14 +02:00
|
|
|
|
2000-05-30 22:04:21 +02:00
|
|
|
if (dest->ctx != NULL) {
|
|
|
|
ERR("Could not share display lists, context already created !\n");
|
|
|
|
return FALSE;
|
|
|
|
} else {
|
|
|
|
if (org->ctx == NULL) {
|
|
|
|
ENTER_GL();
|
2002-03-23 22:43:56 +01:00
|
|
|
org->ctx = glXCreateContext(org->display, org->vis, NULL, True);
|
2000-05-30 22:04:21 +02:00
|
|
|
LEAVE_GL();
|
|
|
|
TRACE(" created a delayed OpenGL context (%p) for Wine context %p\n", org->ctx, org);
|
|
|
|
}
|
|
|
|
|
|
|
|
ENTER_GL();
|
|
|
|
/* Create the destination context with display lists shared */
|
2002-03-23 22:43:56 +01:00
|
|
|
dest->ctx = glXCreateContext(org->display, dest->vis, org->ctx, True);
|
2000-05-30 22:04:21 +02:00
|
|
|
LEAVE_GL();
|
|
|
|
TRACE(" created a delayed OpenGL context (%p) for Wine context %p sharing lists with OpenGL ctx %p\n", dest->ctx, dest, org->ctx);
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-05-30 22:04:21 +02:00
|
|
|
return TRUE;
|
2000-05-12 22:18:14 +02:00
|
|
|
}
|
|
|
|
|
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) {
|
2002-10-19 01:48:57 +02:00
|
|
|
TRACE("(%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
|
|
|
}
|
|
|
|
|
2004-01-06 01:36:13 +01:00
|
|
|
static BOOL internal_wglUseFontBitmaps(HDC hdc,
|
|
|
|
DWORD first,
|
|
|
|
DWORD count,
|
|
|
|
DWORD listBase,
|
|
|
|
DWORD WINAPI (*GetGlyphOutline_ptr)(HDC,UINT,UINT,LPGLYPHMETRICS,DWORD,LPVOID,const MAT2*))
|
2002-03-23 22:43:56 +01:00
|
|
|
{
|
2002-07-08 21:34:26 +02:00
|
|
|
/* We are running using client-side rendering fonts... */
|
|
|
|
GLYPHMETRICS gm;
|
|
|
|
static const MAT2 id = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
|
|
|
|
int glyph;
|
|
|
|
int size = 0;
|
|
|
|
void *bitmap = NULL, *gl_bitmap = NULL;
|
|
|
|
int org_alignment;
|
|
|
|
|
|
|
|
ENTER_GL();
|
|
|
|
glGetIntegerv(GL_UNPACK_ALIGNMENT, &org_alignment);
|
|
|
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
|
|
|
LEAVE_GL();
|
|
|
|
|
|
|
|
for (glyph = first; glyph < first + count; glyph++) {
|
2004-01-06 01:36:13 +01:00
|
|
|
int needed_size = GetGlyphOutline_ptr(hdc, glyph, GGO_BITMAP, &gm, 0, NULL, &id);
|
|
|
|
int height, width_int;
|
|
|
|
|
|
|
|
if (needed_size == GDI_ERROR) goto error;
|
|
|
|
if (needed_size > size) {
|
|
|
|
size = needed_size;
|
|
|
|
if (bitmap) HeapFree(GetProcessHeap(), 0, bitmap);
|
|
|
|
if (gl_bitmap) HeapFree(GetProcessHeap(), 0, gl_bitmap);
|
|
|
|
bitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
|
|
|
|
gl_bitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
|
|
|
|
}
|
|
|
|
if (GetGlyphOutline_ptr(hdc, glyph, GGO_BITMAP, &gm, size, bitmap, &id) == GDI_ERROR) goto error;
|
|
|
|
if (TRACE_ON(opengl)) {
|
|
|
|
unsigned int height, width, bitmask;
|
|
|
|
unsigned char *bitmap_ = (unsigned char *) bitmap;
|
|
|
|
|
|
|
|
DPRINTF("Glyph : %d\n", glyph);
|
|
|
|
DPRINTF(" - bbox : %d x %d\n", gm.gmBlackBoxX, gm.gmBlackBoxY);
|
|
|
|
DPRINTF(" - origin : (%ld , %ld)\n", gm.gmptGlyphOrigin.x, gm.gmptGlyphOrigin.y);
|
|
|
|
DPRINTF(" - increment : %d - %d\n", gm.gmCellIncX, gm.gmCellIncY);
|
|
|
|
DPRINTF(" - size : %d\n", needed_size);
|
|
|
|
DPRINTF(" - bitmap : \n");
|
|
|
|
for (height = 0; height < gm.gmBlackBoxY; height++) {
|
|
|
|
DPRINTF(" ");
|
|
|
|
for (width = 0, bitmask = 0x80; width < gm.gmBlackBoxX; width++, bitmask >>= 1) {
|
|
|
|
if (bitmask == 0) {
|
|
|
|
bitmap_ += 1;
|
|
|
|
bitmask = 0x80;
|
|
|
|
}
|
|
|
|
if (*bitmap_ & bitmask)
|
|
|
|
DPRINTF("*");
|
|
|
|
else
|
|
|
|
DPRINTF(" ");
|
|
|
|
}
|
|
|
|
bitmap_ += (4 - (((unsigned int) bitmap_) & 0x03));
|
|
|
|
DPRINTF("\n");
|
2002-07-08 21:34:26 +02:00
|
|
|
}
|
|
|
|
}
|
2004-01-06 01:36:13 +01:00
|
|
|
|
|
|
|
/* For some obscure reasons, I seem to need to rotate the glyph for OpenGL to be happy.
|
|
|
|
As Wine does not seem to support the MAT2 field, I need to do it myself.... */
|
|
|
|
width_int = (gm.gmBlackBoxX + 31) / 32;
|
|
|
|
for (height = 0; height < gm.gmBlackBoxY; height++) {
|
|
|
|
int width;
|
|
|
|
for (width = 0; width < width_int; width++) {
|
|
|
|
((int *) gl_bitmap)[(gm.gmBlackBoxY - height - 1) * width_int + width] =
|
|
|
|
((int *) bitmap)[height * width_int + width];
|
|
|
|
}
|
2002-07-08 21:34:26 +02:00
|
|
|
}
|
2004-01-06 01:36:13 +01:00
|
|
|
|
|
|
|
ENTER_GL();
|
|
|
|
glNewList(listBase++, GL_COMPILE);
|
|
|
|
glBitmap(gm.gmBlackBoxX, gm.gmBlackBoxY, gm.gmptGlyphOrigin.x,
|
|
|
|
gm.gmBlackBoxY - gm.gmptGlyphOrigin.y, gm.gmCellIncX, gm.gmCellIncY, gl_bitmap);
|
|
|
|
glEndList();
|
|
|
|
LEAVE_GL();
|
2002-07-08 21:34:26 +02:00
|
|
|
}
|
2004-01-06 01:36:13 +01:00
|
|
|
|
2002-07-08 21:34:26 +02:00
|
|
|
ENTER_GL();
|
|
|
|
glPixelStorei(GL_UNPACK_ALIGNMENT, org_alignment);
|
|
|
|
LEAVE_GL();
|
2004-01-06 01:36:13 +01:00
|
|
|
|
2002-07-08 21:34:26 +02:00
|
|
|
if (bitmap) HeapFree(GetProcessHeap(), 0, bitmap);
|
|
|
|
if (gl_bitmap) HeapFree(GetProcessHeap(), 0, gl_bitmap);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
error:
|
|
|
|
ENTER_GL();
|
|
|
|
glPixelStorei(GL_UNPACK_ALIGNMENT, org_alignment);
|
|
|
|
LEAVE_GL();
|
|
|
|
|
|
|
|
if (bitmap) HeapFree(GetProcessHeap(), 0, bitmap);
|
|
|
|
if (gl_bitmap) HeapFree(GetProcessHeap(), 0, gl_bitmap);
|
2004-01-06 01:36:13 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* wglUseFontBitmapsA (OPENGL32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI wglUseFontBitmapsA(HDC hdc,
|
|
|
|
DWORD first,
|
|
|
|
DWORD count,
|
|
|
|
DWORD listBase)
|
|
|
|
{
|
|
|
|
Font fid = get_font( hdc );
|
|
|
|
|
|
|
|
TRACE("(%p, %ld, %ld, %ld) using font %ld\n", hdc, first, count, listBase, fid);
|
|
|
|
|
|
|
|
if (fid == 0) {
|
|
|
|
return internal_wglUseFontBitmaps(hdc, first, count, listBase, GetGlyphOutlineA);
|
|
|
|
}
|
|
|
|
|
|
|
|
ENTER_GL();
|
|
|
|
/* I assume that the glyphs are at the same position for X and for Windows */
|
|
|
|
glXUseXFont(fid, first, count, listBase);
|
|
|
|
LEAVE_GL();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* wglUseFontBitmapsW (OPENGL32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI wglUseFontBitmapsW(HDC hdc,
|
|
|
|
DWORD first,
|
|
|
|
DWORD count,
|
|
|
|
DWORD listBase)
|
|
|
|
{
|
|
|
|
Font fid = get_font( hdc );
|
|
|
|
|
|
|
|
TRACE("(%p, %ld, %ld, %ld) using font %ld\n", hdc, first, count, listBase, fid);
|
|
|
|
|
|
|
|
if (fid == 0) {
|
|
|
|
return internal_wglUseFontBitmaps(hdc, first, count, listBase, GetGlyphOutlineW);
|
2002-07-08 21:34:26 +02:00
|
|
|
}
|
2000-05-23 03:20:08 +02:00
|
|
|
|
2004-01-06 01:36:13 +01:00
|
|
|
WARN("Using the glX API for the WCHAR variant - some characters may come out incorrectly !\n");
|
|
|
|
|
2000-05-23 03:20:08 +02:00
|
|
|
ENTER_GL();
|
|
|
|
/* I assume that the glyphs are at the same position for X and for Windows */
|
|
|
|
glXUseXFont(fid, first, count, listBase);
|
|
|
|
LEAVE_GL();
|
|
|
|
return TRUE;
|
2000-05-12 22:18:14 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02: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,
|
|
|
|
LPGLYPHMETRICSFLOAT lpgmf) {
|
2000-05-12 22:18:14 +02:00
|
|
|
FIXME("(): stub !\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-07-11 05:50:19 +02:00
|
|
|
/* No need to load any other libraries as according to the ABI, libGL should be self-sufficient and
|
|
|
|
include all dependencies
|
|
|
|
*/
|
|
|
|
#ifndef SONAME_LIBGL
|
|
|
|
#define SONAME_LIBGL "libGL.so"
|
|
|
|
#endif
|
2000-06-12 23:53:46 +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)
|
|
|
|
{
|
2001-03-28 03:45:08 +02:00
|
|
|
XWindowAttributes win_attr;
|
|
|
|
Visual *rootVisual;
|
2000-05-12 22:18:14 +02:00
|
|
|
int num;
|
|
|
|
XVisualInfo template;
|
2002-03-23 22:43:56 +01:00
|
|
|
HDC hdc;
|
2000-06-12 23:53:46 +02:00
|
|
|
XVisualInfo *vis = NULL;
|
2001-06-26 23:10:11 +02:00
|
|
|
Window root = (Window)GetPropA( GetDesktopWindow(), "__wine_x11_whole_window" );
|
2002-09-25 02:29:56 +02:00
|
|
|
HMODULE mod = GetModuleHandleA( "x11drv.dll" );
|
2003-07-11 05:50:19 +02:00
|
|
|
void *opengl_handle;
|
2003-12-05 05:43:20 +01:00
|
|
|
|
2002-09-25 02:29:56 +02:00
|
|
|
if (!root || !mod)
|
2001-06-26 23:10:11 +02:00
|
|
|
{
|
|
|
|
ERR("X11DRV not loaded. Cannot create default context.\n");
|
2002-03-23 22:43:56 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-09-25 02:29:56 +02:00
|
|
|
wine_tsx11_lock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_lock" );
|
|
|
|
wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_unlock" );
|
|
|
|
|
2002-03-23 22:43:56 +01:00
|
|
|
hdc = GetDC(0);
|
|
|
|
default_display = get_display( hdc );
|
|
|
|
ReleaseDC( 0, hdc );
|
|
|
|
if (!default_display)
|
|
|
|
{
|
|
|
|
ERR("X11DRV not loaded. Cannot get display for screen DC.\n");
|
|
|
|
return FALSE;
|
2000-06-12 23:53:46 +02:00
|
|
|
}
|
2001-06-26 23:10:11 +02:00
|
|
|
|
2000-05-12 22:18:14 +02:00
|
|
|
ENTER_GL();
|
2001-03-28 03:45:08 +02:00
|
|
|
|
|
|
|
/* Try to get the visual from the Root Window. We can't use the standard (presumably
|
|
|
|
double buffered) X11DRV visual with the Root Window, since we don't know if the Root
|
2002-06-01 01:06:46 +02:00
|
|
|
Window was created using the standard X11DRV visual, and glXMakeCurrent can't deal
|
|
|
|
with mismatched visuals. Note that the Root Window visual may not be double
|
2001-03-28 03:45:08 +02:00
|
|
|
buffered, so apps actually attempting to render this way may flicker */
|
2002-03-23 22:43:56 +01:00
|
|
|
if (XGetWindowAttributes( default_display, root, &win_attr ))
|
2001-03-28 03:45:08 +02:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
rootVisual = win_attr.visual;
|
2001-03-28 03:45:08 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
/* Get the default visual, since we can't seem to get the attributes from the
|
2001-03-28 03:45:08 +02:00
|
|
|
Root Window. Let's hope that the Root Window Visual matches the DefaultVisual */
|
2002-03-23 22:43:56 +01:00
|
|
|
rootVisual = DefaultVisual( default_display, DefaultScreen(default_display) );
|
2001-03-28 03:45:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template.visualid = XVisualIDFromVisual(rootVisual);
|
2002-03-23 22:43:56 +01:00
|
|
|
vis = XGetVisualInfo(default_display, VisualIDMask, &template, &num);
|
|
|
|
if (vis != NULL) default_cx = glXCreateContext(default_display, vis, 0, GL_TRUE);
|
|
|
|
if (default_cx != NULL) glXMakeCurrent(default_display, root, default_cx);
|
2000-06-12 23:53:46 +02:00
|
|
|
XFree(vis);
|
2000-05-12 22:18:14 +02:00
|
|
|
LEAVE_GL();
|
2000-05-30 22:04:21 +02:00
|
|
|
|
2003-12-02 06:27:00 +01:00
|
|
|
opengl_handle = wine_dlopen(SONAME_LIBGL, RTLD_NOW|RTLD_GLOBAL, NULL, 0);
|
|
|
|
if (opengl_handle != NULL) {
|
|
|
|
p_glXGetProcAddressARB = wine_dlsym(opengl_handle, "glXGetProcAddressARB", NULL, 0);
|
|
|
|
wine_dlclose(opengl_handle, NULL, 0);
|
|
|
|
if (p_glXGetProcAddressARB == NULL)
|
|
|
|
TRACE("could not find glXGetProcAddressARB in libGL.\n");
|
2003-07-11 05:50:19 +02:00
|
|
|
}
|
|
|
|
|
2000-06-12 23:53:46 +02:00
|
|
|
if (default_cx == NULL) {
|
|
|
|
ERR("Could not create default context.\n");
|
|
|
|
}
|
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-08-08 23:07:23 +02:00
|
|
|
/**********************************************************************/
|
|
|
|
|
2003-03-06 23:48:54 +01:00
|
|
|
/* Some WGL extensions... */
|
2003-05-07 05:18:51 +02:00
|
|
|
static const char *WGL_extensions = "WGL_ARB_extensions_string WGL_EXT_extensions_string";
|
2003-03-06 23:48:54 +01:00
|
|
|
|
2003-08-08 23:07:23 +02:00
|
|
|
/**********************************************************************/
|
|
|
|
|
2003-03-06 23:48:54 +01:00
|
|
|
const char * WINAPI wglGetExtensionsStringEXT(void) {
|
|
|
|
TRACE("() returning \"%s\"\n", WGL_extensions);
|
|
|
|
|
|
|
|
return WGL_extensions;
|
|
|
|
}
|
|
|
|
|
2003-08-08 23:07:23 +02:00
|
|
|
/**********************************************************************/
|
|
|
|
|
2002-03-23 22:43:56 +01:00
|
|
|
static void process_detach(void)
|
|
|
|
{
|
|
|
|
glXDestroyContext(default_display, default_cx);
|
2000-06-12 23:53:46 +02:00
|
|
|
}
|
|
|
|
|
2003-05-07 05:18:51 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* wglGetExtensionsStringARB(OPENGL32.@)
|
|
|
|
*/
|
|
|
|
const char * WINAPI wglGetExtensionsStringARB(HDC hdc) {
|
|
|
|
|
|
|
|
return wglGetExtensionsStringEXT();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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:
|
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
|
|
|
}
|