Tomas Carnecky : opengl: Properly use glXQueryDrawable() to get the Visual ID.

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 9 05:56:33 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 3a3a0b301367fa882868c952c181bd2d8f1a7e51
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=3a3a0b301367fa882868c952c181bd2d8f1a7e51

Author: Tomas Carnecky <tom at dbservice.com>
Date:   Tue May  9 00:38:00 2006 +0200

opengl: Properly use glXQueryDrawable() to get the Visual ID.

---

 dlls/opengl32/wgl.c |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index c7d3147..a9d0b27 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -509,22 +509,35 @@ static int describeContext(Wine_GLContex
 
 static int describeDrawable(Wine_GLContext* ctx, Drawable drawable) {
   int tmp;
-  int draw_vis_id;
+  int nElements;
+  int attribList[3] = { GLX_FBCONFIG_ID, 0, None };
+  GLXFBConfig *fbCfgs;
+
   if (3 > wine_glx.version || NULL == wine_glx.p_glXQueryDrawable)  {
     /** glXQueryDrawable not available so returns not supported */
     return -1;
   }
+
   TRACE(" Drawable %p have :\n", (void*) drawable);
-  wine_glx.p_glXQueryDrawable(ctx->display, drawable, GLX_FBCONFIG_ID, (unsigned int*) &tmp);
-  TRACE(" - FBCONFIG_ID as 0x%x\n", tmp);
-  wine_glx.p_glXQueryDrawable(ctx->display, drawable, GLX_VISUAL_ID, (unsigned int*) &tmp);
-  TRACE(" - VISUAL_ID as 0x%x\n", tmp);
-  draw_vis_id = tmp;
   wine_glx.p_glXQueryDrawable(ctx->display, drawable, GLX_WIDTH, (unsigned int*) &tmp);
   TRACE(" - WIDTH as %d\n", tmp);
   wine_glx.p_glXQueryDrawable(ctx->display, drawable, GLX_HEIGHT, (unsigned int*) &tmp);
   TRACE(" - HEIGHT as %d\n", tmp);
-  return draw_vis_id;
+  wine_glx.p_glXQueryDrawable(ctx->display, drawable, GLX_FBCONFIG_ID, (unsigned int*) &tmp);
+  TRACE(" - FBCONFIG_ID as 0x%x\n", tmp);
+
+  attribList[1] = tmp;
+  fbCfgs = wine_glx.p_glXChooseFBConfig(ctx->display, DefaultScreen(ctx->display), attribList, &nElements);
+  if (fbCfgs == NULL) {
+    return -1;
+  }
+ 
+  wine_glx.p_glXGetFBConfigAttrib(ctx->display, fbCfgs[0], GLX_VISUAL_ID, &tmp);
+  TRACE(" - VISUAL_ID as 0x%x\n", tmp);
+
+  XFree(fbCfgs);
+ 
+  return tmp;
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list