[OpenGL] Small pedantic fix.

Lionel Ulmer lionel.ulmer at free.fr
Fri Jul 11 15:04:43 CDT 2003


Changelog:
 - check if 'GLX_ARB_get_proc_address' is supported before using
   glXGetProcAddressARB

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
Index: dlls/opengl32/wgl.c
===================================================================
RCS file: /home/wine/wine/dlls/opengl32/wgl.c,v
retrieving revision 1.35
diff -u -r1.35 wgl.c
--- dlls/opengl32/wgl.c	11 Jul 2003 03:50:19 -0000	1.35
+++ dlls/opengl32/wgl.c	11 Jul 2003 20:03:13 -0000
@@ -624,7 +624,8 @@
   Window root = (Window)GetPropA( GetDesktopWindow(), "__wine_x11_whole_window" );
   HMODULE mod = GetModuleHandleA( "x11drv.dll" );
   void *opengl_handle;
-
+  const char *extensions = NULL;
+  
   if (!root || !mod)
   {
       ERR("X11DRV not loaded. Cannot create default context.\n");
@@ -665,13 +666,16 @@
   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);
+  extensions = glXQueryExtensionsString(default_display, DefaultScreen(default_display));
   XFree(vis);
   LEAVE_GL();
 
-  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 ((extensions != NULL) && (strstr(extensions, "GLX_ARB_get_proc_address"))) {
+    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 (default_cx == NULL) {


More information about the wine-patches mailing list