From 412cb77d511fc370932e21e7945d6f902c6992fc Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Mon, 19 Dec 2005 17:45:13 +0100 Subject: [PATCH] opengl: Add support for rendering on bitmaps. --- dlls/opengl32/wgl.c | 24 ++++++++++++++++-------- dlls/x11drv/init.c | 1 + dlls/x11drv/opengl.c | 6 ------ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 30ff1d04f7c..55e8242933c 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -43,10 +43,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(opengl); #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 */ - X11DRV_SET_DRAWABLE, /* set current drawable for a DC */ + 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 */ + X11DRV_GET_GLX_DRAWABLE /* get current glx drawable for a DC */ }; void (*wine_tsx11_lock_ptr)(void) = NULL; @@ -121,11 +126,11 @@ inline static Display *get_display( HDC hdc ) } -/* retrieve the X drawable to use on a given DC */ +/* retrieve the GLX drawable to use on a given DC */ inline static Drawable get_drawable( HDC hdc ) { - Drawable drawable; - enum x11drv_escape_codes escape = X11DRV_GET_DRAWABLE; + GLXDrawable drawable; + enum x11drv_escape_codes escape = X11DRV_GET_GLX_DRAWABLE; if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape, sizeof(drawable), (LPSTR)&drawable )) drawable = 0; @@ -144,7 +149,7 @@ inline static HDC get_hdc_from_Drawable(GLXDrawable d) return NULL; } -/* retrieve the X drawable to use on a given DC */ +/* retrieve the X font to use on a given DC */ inline static Font get_font( HDC hdc ) { Font font; @@ -469,6 +474,7 @@ PROC WINAPI wglGetProcAddress(LPCSTR lpszProc) { BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc) { BOOL ret; + DWORD type = GetObjectType(hdc); TRACE("(%p,%p)\n", hdc, hglrc); @@ -523,6 +529,8 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, } TRACE(" make current for dis %p, drawable %p, ctx %p\n", ctx->display, (void*) drawable, ctx->ctx); ret = glXMakeCurrent(ctx->display, drawable, ctx->ctx); + if(ret && type == OBJ_MEMDC) + glDrawBuffer(GL_FRONT_LEFT); } LEAVE_GL(); TRACE(" returning %s\n", (ret ? "True" : "False")); diff --git a/dlls/x11drv/init.c b/dlls/x11drv/init.c index 69cfa028431..c2729b46585 100644 --- a/dlls/x11drv/init.c +++ b/dlls/x11drv/init.c @@ -415,6 +415,7 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID if(!physDev->bitmap->glxpixmap) physDev->bitmap->glxpixmap = create_glxpixmap(physDev); + X11DRV_CoerceDIBSection(physDev, DIB_Status_GdiMod, FALSE); *(Drawable *)out_data = physDev->bitmap->glxpixmap; } else diff --git a/dlls/x11drv/opengl.c b/dlls/x11drv/opengl.c index c119e7cd0ae..a2a591e2e94 100644 --- a/dlls/x11drv/opengl.c +++ b/dlls/x11drv/opengl.c @@ -199,12 +199,6 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev, dump_PIXELFORMATDESCRIPTOR((const PIXELFORMATDESCRIPTOR *) ppfd); } - if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP) { - ERR("Flag not supported !\n"); - /* Should SetError here... */ - return 0; - } - /* Now, build the request to GLX */ if (ppfd->iPixelType == PFD_TYPE_COLORINDEX) {