[Xquartz-changes] xserver: Branch 'server-1.11-apple' - 5 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Tue Jun 14 13:51:07 PDT 2011


Rebased ref, commits from common ancestor:
commit 7ab38b975334559fcf4d45e18fc297303555f68f
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Feb 12 19:48:52 2010 -0800

    fb: Revert fb changes that broke XQuartz
    
    http://bugs.freedesktop.org/show_bug.cgi?id=26124
    
    Revert "Fix source pictures getting random transforms after 2d6a8f668342a5190cdf43b5."
    Revert "fb: Adjust transform or composite coordinates for pixman operations"
    
    http://bugs.freedesktop.org/26124
    
    This reverts commit a72c65e9176c51de95db2fdbf4c5d946a4911695.
    This reverts commit a6bd5d2e482a5aa84acb3d4932e2a166d8670ef1.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/fb/fb.h b/fb/fb.h
index eaa21ad..e65a1c0 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2049,11 +2049,8 @@ fbFillRegionSolid (DrawablePtr	pDrawable,
 		   FbBits	xor);
 
 extern _X_EXPORT pixman_image_t *
-image_from_pict (PicturePtr	pict,
-		 Bool		has_clip,
-		 int		*xoff,
-		 int		*yoff);
-
+image_from_pict (PicturePtr pict,
+		 Bool       has_clip);
 extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
 
 #endif /* _FB_H_ */
diff --git a/fb/fbpict.c b/fb/fbpict.c
index d1fd0cb..d2986c8 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -50,24 +50,19 @@ fbComposite (CARD8      op,
 	     CARD16     height)
 {
     pixman_image_t *src, *mask, *dest;
-    int src_xoff, src_yoff;
-    int msk_xoff, msk_yoff;
-    int dst_xoff, dst_yoff;
     
     miCompositeSourceValidate (pSrc);
     if (pMask)
 	miCompositeSourceValidate (pMask);
     
-    src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
-    mask = image_from_pict (pMask, FALSE, &msk_xoff, &msk_yoff);
-    dest = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
+    src = image_from_pict (pSrc, TRUE);
+    mask = image_from_pict (pMask, TRUE);
+    dest = image_from_pict (pDst, TRUE);
 
     if (src && dest && !(pMask && !mask))
     {
 	pixman_image_composite (op, src, mask, dest,
-				xSrc + src_xoff, ySrc + src_yoff,
-				xMask + msk_xoff, yMask + msk_yoff,
-				xDst + dst_xoff, yDst + dst_yoff,
+				xSrc, ySrc, xMask, yMask, xDst, yDst,
 				width, height);
     }
 
@@ -146,22 +141,22 @@ create_conical_gradient_image (PictGradient *gradient)
 
 static pixman_image_t *
 create_bits_picture (PicturePtr pict,
-		     Bool       has_clip,
-		     int	*xoff,
-		     int	*yoff)
+		     Bool       has_clip)
 {
-    PixmapPtr pixmap;
     FbBits *bits;
     FbStride stride;
-    int bpp;
+    int bpp, xoff, yoff;
     pixman_image_t *image;
     
-    fbGetDrawablePixmap (pict->pDrawable, pixmap, *xoff, *yoff);
-    fbGetPixmapBitsData(pixmap, bits, stride, bpp);
+    fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
+
+    bits = (FbBits*)((CARD8*)bits +
+		     (pict->pDrawable->y + yoff) * stride * sizeof(FbBits) +
+		     (pict->pDrawable->x + xoff) * (bpp / 8));
 
     image = pixman_image_create_bits (
 	(pixman_format_code_t)pict->format,
-	pixmap->drawable.width, pixmap->drawable.height,
+	pict->pDrawable->width, pict->pDrawable->height,
 	(uint32_t *)bits, stride * sizeof (FbStride));
     
     
@@ -187,55 +182,33 @@ create_bits_picture (PicturePtr pict,
 	if (pict->clientClipType != CT_NONE)
 	    pixman_image_set_has_client_clip (image, TRUE);
 
-	if (*xoff || *yoff)
-	    pixman_region_translate (pict->pCompositeClip, *xoff, *yoff);
+	pixman_region_translate (pict->pCompositeClip, - pict->pDrawable->x, - pict->pDrawable->y);
 
 	pixman_image_set_clip_region (image, pict->pCompositeClip);
 
-	if (*xoff || *yoff)
-	    pixman_region_translate (pict->pCompositeClip, -*xoff, -*yoff);
+	pixman_region_translate (pict->pCompositeClip, pict->pDrawable->x, pict->pDrawable->y);
     }
     
     /* Indexed table */
     if (pict->pFormat->index.devPrivate)
 	pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
 
-    /* Add in drawable origin to position within the image */
-    *xoff += pict->pDrawable->x;
-    *yoff += pict->pDrawable->y;
-
     return image;
 }
 
 static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map);
+image_from_pict_internal (PicturePtr pict, Bool has_clip, Bool is_alpha_map);
 
 static void
-set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+set_image_properties (pixman_image_t *image, PicturePtr pict, Bool is_alpha_map)
 {
     pixman_repeat_t repeat;
     pixman_filter_t filter;
     
     if (pict->transform)
     {
-	/* For source images, adjust the transform to account
-	 * for the drawable offset within the pixman image,
-	 * then set the offset to 0 as it will be used
-	 * to compute positions within the transformed image.
-	 */
-	if (!has_clip) {
-	    struct pixman_transform	adjusted;
-
-	    adjusted = *pict->transform;
-	    pixman_transform_translate(&adjusted,
-				       NULL,
-				       pixman_int_to_fixed(*xoff),
-				       pixman_int_to_fixed(*yoff));
-	    pixman_image_set_transform (image, &adjusted);
-	    *xoff = 0;
-	    *yoff = 0;
-	} else
-	    pixman_image_set_transform (image, pict->transform);
+	pixman_image_set_transform (
+	    image, (pixman_transform_t *)pict->transform);
     }
     
     switch (pict->repeatType)
@@ -265,8 +238,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
      */
     if (pict->alphaMap && !is_alpha_map)
     {
-	int alpha_xoff, alpha_yoff;
-	pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff, TRUE);
+	pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, TRUE, TRUE);
 	
 	pixman_image_set_alpha_map (
 	    image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
@@ -299,7 +271,8 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
 }
 
 static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+image_from_pict_internal (PicturePtr pict,
+		 Bool has_clip, Bool is_alpha_map)
 {
     pixman_image_t *image = NULL;
 
@@ -308,7 +281,7 @@ image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
 
     if (pict->pDrawable)
     {
-	image = create_bits_picture (pict, has_clip, xoff, yoff);
+	image = create_bits_picture (pict, has_clip);
     }
     else if (pict->pSourcePict)
     {
@@ -329,19 +302,18 @@ image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
 	    else if (sp->type == SourcePictTypeConical)
 		image = create_conical_gradient_image (gradient);
 	}
-	*xoff = *yoff = 0;
     }
     
     if (image)
-	set_image_properties (image, pict, has_clip, xoff, yoff, is_alpha_map);
+	set_image_properties (image, pict, is_alpha_map);
     
     return image;
 }
 
 pixman_image_t *
-image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+image_from_pict (PicturePtr pict, Bool has_clip)
 {
-    return image_from_pict_internal (pict, has_clip, xoff, yoff, FALSE);
+    return image_from_pict_internal (pict, has_clip, FALSE);
 }
 
 void
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 0b5a638..fbe2647 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -39,12 +39,11 @@ fbAddTraps (PicturePtr	pPicture,
 	    xTrap	*traps)
 {
     pixman_image_t *image;
-    int dst_xoff, dst_yoff;
 
-    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+    if (!(image = image_from_pict (pPicture, FALSE)))
 	return;
     
-    pixman_add_traps (image, x_off + dst_xoff, y_off + dst_yoff,
+    pixman_add_traps (image, x_off, y_off,
 		      ntrap, (pixman_trap_t *)traps);
 
     free_pixman_pict (pPicture, image);
@@ -57,14 +56,13 @@ fbRasterizeTrapezoid (PicturePtr    pPicture,
 		      int	    y_off)
 {
     pixman_image_t *image;
-    int	dst_xoff, dst_yoff;
 
-    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+    if (!(image = image_from_pict (pPicture, FALSE)))
 	return;
 
     pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap,
-				x_off + dst_xoff,
-				y_off + dst_yoff);
+				x_off,
+				y_off);
 
     free_pixman_pict (pPicture, image);
 }
@@ -77,13 +75,12 @@ fbAddTriangles (PicturePtr  pPicture,
 		xTriangle *tris)
 {
     pixman_image_t *image;
-    int dst_xoff, dst_yoff;
 
-    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+    if (!(image = image_from_pict (pPicture, FALSE)))
 	return;
     
     pixman_add_triangles (image,
-			  dst_xoff + x_off, dst_yoff + y_off,
+			  x_off, y_off,
 			  ntri, (pixman_triangle_t *)tris);
 
     free_pixman_pict (pPicture, image);
@@ -110,13 +107,11 @@ fbShapes (CompositeShapesFunc	composite,
 	  const uint8_t *	shapes)
 {
     pixman_image_t *src, *dst;
-    int src_xoff, src_yoff;
-    int dst_xoff, dst_yoff;
 
     miCompositeSourceValidate (pSrc);
 
-    src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
-    dst = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
+    src = image_from_pict (pSrc, FALSE);
+    dst = image_from_pict (pDst, TRUE);
 
     if (src && dst)
     {
@@ -136,10 +131,10 @@ fbShapes (CompositeShapesFunc	composite,
 	    for (i = 0; i < nshapes; ++i)
 	    {
 		composite (op, src, dst, format,
-			   xSrc + src_xoff,
-			   ySrc + src_yoff,
-			   dst_xoff,
-			   dst_yoff,
+			   xSrc,
+			   ySrc,
+			   0,
+			   0,
 			   1, shapes + i * shape_size);
 	    }
 	}
@@ -162,10 +157,10 @@ fbShapes (CompositeShapesFunc	composite,
 	    }
 	    
 	    composite (op, src, dst, format,
-		       xSrc + src_xoff,
-		       ySrc + src_yoff,
-		       dst_xoff,
-		       dst_yoff,
+		       xSrc,
+		       ySrc,
+		       0,
+		       0,
 		       nshapes, shapes);
 	}
 
commit bad03d62aefaabdd1e88b7e5699e4211fcf5c243
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Apr 30 13:08:25 2010 -0700

    Workaround the GC clipping problem in miPaintWindow and add some debugging output.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/mi/miexpose.c b/mi/miexpose.c
index 94258b8..4f25c23 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -521,6 +521,7 @@ void RootlessSetPixmapOfAncestors(WindowPtr pWin);
 void RootlessStartDrawing(WindowPtr pWin);
 void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
 Bool IsFramedWindow(WindowPtr pWin);
+#include "../fb/fb.h"
 #endif 
 
 void
@@ -548,24 +549,37 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     Bool	solid = TRUE;
     DrawablePtr	drawable = &pWin->drawable;
 
+#ifdef XQUARTZ_CLIP_DEBUG
+    ErrorF("START %d BS %d (pR = %ld)\n", what, pWin->backgroundState, ParentRelative);
+    ErrorF("      Rgn: %d %d %d %d\n", prgn->extents.x1, prgn->extents.y1,
+	                               prgn->extents.x2 - prgn->extents.x1,
+	                               prgn->extents.y2 - prgn->extents.y1);
+    ErrorF("      Win: %d %d (%d %d) %d %d\n", pWin->origin.x, pWin->origin.y,
+	                                       pWin->winSize.extents.x1, pWin->winSize.extents.y1,
+	                                       pWin->winSize.extents.x2 - pWin->winSize.extents.x1,
+					       pWin->winSize.extents.y2 - pWin->winSize.extents.y1);
+    ErrorF("     Draw: %d %d %d %d\n", pWin->drawable.x, pWin->drawable.y,
+				       pWin->drawable.width, pWin->drawable.height);
+#endif
+
 #ifdef ROOTLESS
     if(!drawable || drawable->type == UNDRAWABLE_WINDOW)
 	return;
-
-    if(IsFramedWindow(pWin)) {
-        RootlessStartDrawing(pWin);
-        RootlessDamageRegion(pWin, prgn);
-    
-        if(pWin->backgroundState == ParentRelative) {
-            if((what == PW_BACKGROUND) || 
-               (what == PW_BORDER && !pWin->borderIsPixel))
-                RootlessSetPixmapOfAncestors(pWin);
-        }
-    }
 #endif
     
     if (what == PW_BACKGROUND)
     {
+#ifdef ROOTLESS
+	if(IsFramedWindow(pWin)) {
+	    RootlessStartDrawing(pWin);
+	    RootlessDamageRegion(pWin, prgn);
+
+	    if(pWin->backgroundState == ParentRelative) {
+		RootlessSetPixmapOfAncestors(pWin);
+	    }
+	}
+#endif
+
 	while (pWin->backgroundState == ParentRelative)
 	    pWin = pWin->parent;
 
@@ -587,6 +601,18 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     {
 	PixmapPtr   pixmap;
 
+#ifdef ROOTLESS
+	if(IsFramedWindow(pWin)) {
+	    RootlessStartDrawing(pWin);
+	    RootlessDamageRegion(pWin, prgn);
+	    
+	    if(!pWin->borderIsPixel &&
+		pWin->backgroundState == ParentRelative) {
+		RootlessSetPixmapOfAncestors(pWin);
+	    }
+	}
+#endif
+
 	tile_x_off = drawable->x;
 	tile_y_off = drawable->y;
 	
@@ -595,6 +621,12 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
 	    return;
 	pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable);
 	drawable = &pixmap->drawable;
+
+#ifdef XQUARTZ_CLIP_DEBUG
+	ErrorF("     Draw: %d %d %d %d\n",
+	       drawable->x, drawable->y, drawable->width, drawable->height);    
+#endif
+	
 #ifdef COMPOSITE
 	draw_x_off = pixmap->screen_x;
 	draw_y_off = pixmap->screen_y;
@@ -657,6 +689,57 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     ChangeGC (NullClient, pGC, gcmask, gcval);
     ValidateGC (drawable, pGC);
 
+#ifdef XQUARTZ_CLIP_DEBUG
+    ErrorF("       GC: %d %d %d %d\n",
+	   pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+	   pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+	   pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
+#endif
+    
+#ifdef XQUARTZ
+    /* Looks like our clipping isn't set right for some reason:
+     * http://xquartz.macosforge.org/trac/ticket/290
+     */
+    if(what == PW_BORDER) {
+
+#if 0
+	if(solid) {
+#if 1
+	    fbFillRegionSolid(&pWin->drawable,
+			      prgn,
+			      0,
+			      fbReplicatePixel(fill.pixel,
+					       pWin->drawable.bitsPerPixel));
+#else
+	    fbFillRegionSolid(drawable,
+			      prgn,
+			      0,
+			      fbReplicatePixel(fill.pixel,
+					       drawable->bitsPerPixel));
+#endif
+	    return;
+	}
+#endif
+    
+	pGC->pCompositeClip->extents.x1 += prgn->extents.x1;
+	pGC->pCompositeClip->extents.y1 += prgn->extents.y1;
+	pGC->pCompositeClip->extents.x2 += prgn->extents.x1;
+	pGC->pCompositeClip->extents.y2 += prgn->extents.y1;
+	
+	if(pGC->pCompositeClip->extents.x2 > drawable->pScreen->width)
+	    pGC->pCompositeClip->extents.x2 = drawable->pScreen->width;
+	if(pGC->pCompositeClip->extents.y2 > drawable->pScreen->height)
+	    pGC->pCompositeClip->extents.y2 = drawable->pScreen->height;
+    }
+#endif
+
+#ifdef XQUARTZ_CLIP_DEBUG
+    ErrorF("       GC: %d %d %d %d\n",
+	   pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+	   pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+	   pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);    
+#endif
+
     numRects = RegionNumRects(prgn);
     pbox = RegionRects(prgn);
     for (i= numRects; --i >= 0; pbox++, prect++)
commit 34e5bc22544db0e05ae841bc6b6a6ea2ce754f86
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Oct 30 14:55:06 2010 -0700

    configure.ac: Add -fno-strict-aliasing to CFLAGS
    
    This should address https://bugs.freedesktop.org/show_bug.cgi?id=31238
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index 22566c9..f3f298e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,6 +87,12 @@ XORG_PROG_RAWCPP
 # easier overrides at build time.
 XSERVER_CFLAGS='$(CWARNFLAGS)'
 
+dnl Explicitly add -fno-strict-aliasing since this option should disappear
+dnl from util-macros CWARNFLAGS
+if  test "x$GCC" = xyes ; then
+    XSERVER_CFLAGS="$XSERVER_CFLAGS -fno-strict-aliasing"
+fi
+
 dnl Check for dtrace program (needed to build Xserver dtrace probes)
 dnl Also checks for <sys/sdt.h>, since some Linux distros have an 
 dnl ISDN trace program named dtrace
commit 48a72a3a1c38039dbfec360dd50aad80acbbff9e
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue Jun 14 13:23:00 2011 -0700

    XQuartz: GLX: Fix a -Wformat-security compilation warning
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index d03dfaa..4116872 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -504,7 +504,7 @@ static void __glXAquaDrawableDestroy(__GLXdrawable *base) {
      */
     __GLXAquaDrawable *glxPriv = (__GLXAquaDrawable *)base;
 
-    GLAQUA_DEBUG_MSG(__func__);
+    GLAQUA_DEBUG_MSG("TRACE");
     
     /* It doesn't work to call DRIDestroySurface here, the drawable's
        already gone.. But dri.c notices the window destruction and
commit f8bedae8f2dedf58292e1d2240cae727508a49dc
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue Jun 14 11:18:50 2011 -0700

    XQuartz: GLX: Use _glapi_create_table_from_handle to create out dispatch table
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index ca25e73..d03dfaa 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -566,924 +566,36 @@ GLuint __glFloorLog2(GLuint val)
     return c;
 }
 
+#ifndef OPENGL_FRAMEWORK_PATH
+#define OPENGL_FRAMEWORK_PATH "/System/Library/Frameworks/OpenGL.framework/OpenGL"
+#endif
+
 static void setup_dispatch_table(void) {
     static struct _glapi_table *disp = NULL;
+    static void *handle;
+    const char *opengl_framework_path;
 
     if(disp)  {
         _glapi_set_dispatch(disp);
         return;
     }
 
-    disp=calloc(1,sizeof(struct _glapi_table));
-    assert(disp);
-
-    /* to update:
-     * for f in $(grep 'define SET_' ../../../glx/dispatch.h  | cut -f2 -d' ' | cut -f1 -d\( | sort -u); do grep -q $f indirect.c && echo $f ; done | grep -v by_offset | sed 's:SET_\(.*\)$:SET_\1(disp, dlsym(RTLD_DEFAULT, "gl\1"))\;:'
-     */
-
-    SET_Accum(disp, dlsym(RTLD_DEFAULT, "glAccum"));
-    SET_AlphaFunc(disp, dlsym(RTLD_DEFAULT, "glAlphaFunc"));
-    SET_AreTexturesResident(disp, dlsym(RTLD_DEFAULT, "glAreTexturesResident"));
-    SET_ArrayElement(disp, dlsym(RTLD_DEFAULT, "glArrayElement"));
-    SET_Begin(disp, dlsym(RTLD_DEFAULT, "glBegin"));
-    SET_BindTexture(disp, dlsym(RTLD_DEFAULT, "glBindTexture"));
-    SET_Bitmap(disp, dlsym(RTLD_DEFAULT, "glBitmap"));
-    SET_BlendColor(disp, dlsym(RTLD_DEFAULT, "glBlendColor"));
-    SET_BlendEquation(disp, dlsym(RTLD_DEFAULT, "glBlendEquation"));
-    SET_BlendFunc(disp, dlsym(RTLD_DEFAULT, "glBlendFunc"));
-    SET_CallList(disp, dlsym(RTLD_DEFAULT, "glCallList"));
-    SET_CallLists(disp, dlsym(RTLD_DEFAULT, "glCallLists"));
-    SET_Clear(disp, dlsym(RTLD_DEFAULT, "glClear"));
-    SET_ClearAccum(disp, dlsym(RTLD_DEFAULT, "glClearAccum"));
-    SET_ClearColor(disp, dlsym(RTLD_DEFAULT, "glClearColor"));
-    SET_ClearDepth(disp, dlsym(RTLD_DEFAULT, "glClearDepth"));
-    SET_ClearIndex(disp, dlsym(RTLD_DEFAULT, "glClearIndex"));
-    SET_ClearStencil(disp, dlsym(RTLD_DEFAULT, "glClearStencil"));
-    SET_ClipPlane(disp, dlsym(RTLD_DEFAULT, "glClipPlane"));
-    SET_Color3b(disp, dlsym(RTLD_DEFAULT, "glColor3b"));
-    SET_Color3bv(disp, dlsym(RTLD_DEFAULT, "glColor3bv"));
-    SET_Color3d(disp, dlsym(RTLD_DEFAULT, "glColor3d"));
-    SET_Color3dv(disp, dlsym(RTLD_DEFAULT, "glColor3dv"));
-    SET_Color3f(disp, dlsym(RTLD_DEFAULT, "glColor3f"));
-    SET_Color3fv(disp, dlsym(RTLD_DEFAULT, "glColor3fv"));
-    SET_Color3i(disp, dlsym(RTLD_DEFAULT, "glColor3i"));
-    SET_Color3iv(disp, dlsym(RTLD_DEFAULT, "glColor3iv"));
-    SET_Color3s(disp, dlsym(RTLD_DEFAULT, "glColor3s"));
-    SET_Color3sv(disp, dlsym(RTLD_DEFAULT, "glColor3sv"));
-    SET_Color3ub(disp, dlsym(RTLD_DEFAULT, "glColor3ub"));
-    SET_Color3ubv(disp, dlsym(RTLD_DEFAULT, "glColor3ubv"));
-    SET_Color3ui(disp, dlsym(RTLD_DEFAULT, "glColor3ui"));
-    SET_Color3uiv(disp, dlsym(RTLD_DEFAULT, "glColor3uiv"));
-    SET_Color3us(disp, dlsym(RTLD_DEFAULT, "glColor3us"));
-    SET_Color3usv(disp, dlsym(RTLD_DEFAULT, "glColor3usv"));
-    SET_Color4b(disp, dlsym(RTLD_DEFAULT, "glColor4b"));
-    SET_Color4bv(disp, dlsym(RTLD_DEFAULT, "glColor4bv"));
-    SET_Color4d(disp, dlsym(RTLD_DEFAULT, "glColor4d"));
-    SET_Color4dv(disp, dlsym(RTLD_DEFAULT, "glColor4dv"));
-    SET_Color4f(disp, dlsym(RTLD_DEFAULT, "glColor4f"));
-    SET_Color4fv(disp, dlsym(RTLD_DEFAULT, "glColor4fv"));
-    SET_Color4i(disp, dlsym(RTLD_DEFAULT, "glColor4i"));
-    SET_Color4iv(disp, dlsym(RTLD_DEFAULT, "glColor4iv"));
-    SET_Color4s(disp, dlsym(RTLD_DEFAULT, "glColor4s"));
-    SET_Color4sv(disp, dlsym(RTLD_DEFAULT, "glColor4sv"));
-    SET_Color4ub(disp, dlsym(RTLD_DEFAULT, "glColor4ub"));
-    SET_Color4ubv(disp, dlsym(RTLD_DEFAULT, "glColor4ubv"));
-    SET_Color4ui(disp, dlsym(RTLD_DEFAULT, "glColor4ui"));
-    SET_Color4uiv(disp, dlsym(RTLD_DEFAULT, "glColor4uiv"));
-    SET_Color4us(disp, dlsym(RTLD_DEFAULT, "glColor4us"));
-    SET_Color4usv(disp, dlsym(RTLD_DEFAULT, "glColor4usv"));
-    SET_ColorMask(disp, dlsym(RTLD_DEFAULT, "glColorMask"));
-    SET_ColorMaterial(disp, dlsym(RTLD_DEFAULT, "glColorMaterial"));
-    SET_ColorPointer(disp, dlsym(RTLD_DEFAULT, "glColorPointer"));
-    SET_ColorSubTable(disp, dlsym(RTLD_DEFAULT, "glColorSubTable"));
-    SET_ColorTable(disp, dlsym(RTLD_DEFAULT, "glColorTable"));
-    SET_ColorTableParameterfv(disp, dlsym(RTLD_DEFAULT, "glColorTableParameterfv"));
-    SET_ColorTableParameteriv(disp, dlsym(RTLD_DEFAULT, "glColorTableParameteriv"));
-    SET_ConvolutionFilter1D(disp, dlsym(RTLD_DEFAULT, "glConvolutionFilter1D"));
-    SET_ConvolutionFilter2D(disp, dlsym(RTLD_DEFAULT, "glConvolutionFilter2D"));
-    SET_ConvolutionParameterf(disp, dlsym(RTLD_DEFAULT, "glConvolutionParameterf"));
-    SET_ConvolutionParameterfv(disp, dlsym(RTLD_DEFAULT, "glConvolutionParameterfv"));
-    SET_ConvolutionParameteri(disp, dlsym(RTLD_DEFAULT, "glConvolutionParameteri"));
-    SET_ConvolutionParameteriv(disp, dlsym(RTLD_DEFAULT, "glConvolutionParameteriv"));
-    SET_CopyColorSubTable(disp, dlsym(RTLD_DEFAULT, "glCopyColorSubTable"));
-    SET_CopyColorTable(disp, dlsym(RTLD_DEFAULT, "glCopyColorTable"));
-    SET_CopyConvolutionFilter1D(disp, dlsym(RTLD_DEFAULT, "glCopyConvolutionFilter1D"));
-    SET_CopyConvolutionFilter2D(disp, dlsym(RTLD_DEFAULT, "glCopyConvolutionFilter2D"));
-    SET_CopyPixels(disp, dlsym(RTLD_DEFAULT, "glCopyPixels"));
-    SET_CopyTexImage1D(disp, dlsym(RTLD_DEFAULT, "glCopyTexImage1D"));
-    SET_CopyTexImage2D(disp, dlsym(RTLD_DEFAULT, "glCopyTexImage2D"));
-    SET_CopyTexSubImage1D(disp, dlsym(RTLD_DEFAULT, "glCopyTexSubImage1D"));
-    SET_CopyTexSubImage2D(disp, dlsym(RTLD_DEFAULT, "glCopyTexSubImage2D"));
-    SET_CopyTexSubImage3D(disp, dlsym(RTLD_DEFAULT, "glCopyTexSubImage3D"));
-    SET_CullFace(disp, dlsym(RTLD_DEFAULT, "glCullFace"));
-    SET_DeleteLists(disp, dlsym(RTLD_DEFAULT, "glDeleteLists"));
-    SET_DeleteTextures(disp, dlsym(RTLD_DEFAULT, "glDeleteTextures"));
-    SET_DepthFunc(disp, dlsym(RTLD_DEFAULT, "glDepthFunc"));
-    SET_DepthMask(disp, dlsym(RTLD_DEFAULT, "glDepthMask"));
-    SET_DepthRange(disp, dlsym(RTLD_DEFAULT, "glDepthRange"));
-    SET_Disable(disp, dlsym(RTLD_DEFAULT, "glDisable"));
-    SET_DisableClientState(disp, dlsym(RTLD_DEFAULT, "glDisableClientState"));
-    SET_DrawArrays(disp, dlsym(RTLD_DEFAULT, "glDrawArrays"));
-    SET_DrawBuffer(disp, dlsym(RTLD_DEFAULT, "glDrawBuffer"));
-    SET_DrawElements(disp, dlsym(RTLD_DEFAULT, "glDrawElements"));
-    SET_DrawPixels(disp, dlsym(RTLD_DEFAULT, "glDrawPixels"));
-    SET_DrawRangeElements(disp, dlsym(RTLD_DEFAULT, "glDrawRangeElements"));
-    SET_EdgeFlag(disp, dlsym(RTLD_DEFAULT, "glEdgeFlag"));
-    SET_EdgeFlagPointer(disp, dlsym(RTLD_DEFAULT, "glEdgeFlagPointer"));
-    SET_EdgeFlagv(disp, dlsym(RTLD_DEFAULT, "glEdgeFlagv"));
-    SET_Enable(disp, dlsym(RTLD_DEFAULT, "glEnable"));
-    SET_EnableClientState(disp, dlsym(RTLD_DEFAULT, "glEnableClientState"));
-    SET_End(disp, dlsym(RTLD_DEFAULT, "glEnd"));
-    SET_EndList(disp, dlsym(RTLD_DEFAULT, "glEndList"));
-    SET_EvalCoord1d(disp, dlsym(RTLD_DEFAULT, "glEvalCoord1d"));
-    SET_EvalCoord1dv(disp, dlsym(RTLD_DEFAULT, "glEvalCoord1dv"));
-    SET_EvalCoord1f(disp, dlsym(RTLD_DEFAULT, "glEvalCoord1f"));
-    SET_EvalCoord1fv(disp, dlsym(RTLD_DEFAULT, "glEvalCoord1fv"));
-    SET_EvalCoord2d(disp, dlsym(RTLD_DEFAULT, "glEvalCoord2d"));
-    SET_EvalCoord2dv(disp, dlsym(RTLD_DEFAULT, "glEvalCoord2dv"));
-    SET_EvalCoord2f(disp, dlsym(RTLD_DEFAULT, "glEvalCoord2f"));
-    SET_EvalCoord2fv(disp, dlsym(RTLD_DEFAULT, "glEvalCoord2fv"));
-    SET_EvalMesh1(disp, dlsym(RTLD_DEFAULT, "glEvalMesh1"));
-    SET_EvalMesh2(disp, dlsym(RTLD_DEFAULT, "glEvalMesh2"));
-    SET_EvalPoint1(disp, dlsym(RTLD_DEFAULT, "glEvalPoint1"));
-    SET_EvalPoint2(disp, dlsym(RTLD_DEFAULT, "glEvalPoint2"));
-    SET_FeedbackBuffer(disp, dlsym(RTLD_DEFAULT, "glFeedbackBuffer"));
-    SET_Finish(disp, dlsym(RTLD_DEFAULT, "glFinish"));
-    SET_Flush(disp, dlsym(RTLD_DEFAULT, "glFlush"));
-    SET_Fogf(disp, dlsym(RTLD_DEFAULT, "glFogf"));
-    SET_Fogfv(disp, dlsym(RTLD_DEFAULT, "glFogfv"));
-    SET_Fogi(disp, dlsym(RTLD_DEFAULT, "glFogi"));
-    SET_Fogiv(disp, dlsym(RTLD_DEFAULT, "glFogiv"));
-    SET_FrontFace(disp, dlsym(RTLD_DEFAULT, "glFrontFace"));
-    SET_Frustum(disp, dlsym(RTLD_DEFAULT, "glFrustum"));
-    SET_GenLists(disp, dlsym(RTLD_DEFAULT, "glGenLists"));
-    SET_GenTextures(disp, dlsym(RTLD_DEFAULT, "glGenTextures"));
-    SET_GetBooleanv(disp, dlsym(RTLD_DEFAULT, "glGetBooleanv"));
-    SET_GetClipPlane(disp, dlsym(RTLD_DEFAULT, "glGetClipPlane"));
-    SET_GetColorTable(disp, dlsym(RTLD_DEFAULT, "glGetColorTable"));
-    SET_GetColorTableParameterfv(disp, dlsym(RTLD_DEFAULT, "glGetColorTableParameterfv"));
-    SET_GetColorTableParameteriv(disp, dlsym(RTLD_DEFAULT, "glGetColorTableParameteriv"));
-    SET_GetConvolutionFilter(disp, dlsym(RTLD_DEFAULT, "glGetConvolutionFilter"));
-    SET_GetConvolutionParameterfv(disp, dlsym(RTLD_DEFAULT, "glGetConvolutionParameterfv"));
-    SET_GetConvolutionParameteriv(disp, dlsym(RTLD_DEFAULT, "glGetConvolutionParameteriv"));
-    SET_GetDoublev(disp, dlsym(RTLD_DEFAULT, "glGetDoublev"));
-    SET_GetError(disp, dlsym(RTLD_DEFAULT, "glGetError"));
-    SET_GetFloatv(disp, dlsym(RTLD_DEFAULT, "glGetFloatv"));
-    SET_GetHistogram(disp, dlsym(RTLD_DEFAULT, "glGetHistogram"));
-    SET_GetHistogramParameterfv(disp, dlsym(RTLD_DEFAULT, "glGetHistogramParameterfv"));
-    SET_GetHistogramParameteriv(disp, dlsym(RTLD_DEFAULT, "glGetHistogramParameteriv"));
-    SET_GetIntegerv(disp, dlsym(RTLD_DEFAULT, "glGetIntegerv"));
-    SET_GetLightfv(disp, dlsym(RTLD_DEFAULT, "glGetLightfv"));
-    SET_GetLightiv(disp, dlsym(RTLD_DEFAULT, "glGetLightiv"));
-    SET_GetMapdv(disp, dlsym(RTLD_DEFAULT, "glGetMapdv"));
-    SET_GetMapfv(disp, dlsym(RTLD_DEFAULT, "glGetMapfv"));
-    SET_GetMapiv(disp, dlsym(RTLD_DEFAULT, "glGetMapiv"));
-    SET_GetMaterialfv(disp, dlsym(RTLD_DEFAULT, "glGetMaterialfv"));
-    SET_GetMaterialiv(disp, dlsym(RTLD_DEFAULT, "glGetMaterialiv"));
-    SET_GetMinmax(disp, dlsym(RTLD_DEFAULT, "glGetMinmax"));
-    SET_GetMinmaxParameterfv(disp, dlsym(RTLD_DEFAULT, "glGetMinmaxParameterfv"));
-    SET_GetMinmaxParameteriv(disp, dlsym(RTLD_DEFAULT, "glGetMinmaxParameteriv"));
-    SET_GetPixelMapfv(disp, dlsym(RTLD_DEFAULT, "glGetPixelMapfv"));
-    SET_GetPixelMapuiv(disp, dlsym(RTLD_DEFAULT, "glGetPixelMapuiv"));
-    SET_GetPixelMapusv(disp, dlsym(RTLD_DEFAULT, "glGetPixelMapusv"));
-    SET_GetPointerv(disp, dlsym(RTLD_DEFAULT, "glGetPointerv"));
-    SET_GetPolygonStipple(disp, dlsym(RTLD_DEFAULT, "glGetPolygonStipple"));
-    SET_GetSeparableFilter(disp, dlsym(RTLD_DEFAULT, "glGetSeparableFilter"));
-    SET_GetString(disp, dlsym(RTLD_DEFAULT, "glGetString"));
-    SET_GetTexEnvfv(disp, dlsym(RTLD_DEFAULT, "glGetTexEnvfv"));
-    SET_GetTexEnviv(disp, dlsym(RTLD_DEFAULT, "glGetTexEnviv"));
-    SET_GetTexGendv(disp, dlsym(RTLD_DEFAULT, "glGetTexGendv"));
-    SET_GetTexGenfv(disp, dlsym(RTLD_DEFAULT, "glGetTexGenfv"));
-    SET_GetTexGeniv(disp, dlsym(RTLD_DEFAULT, "glGetTexGeniv"));
-    SET_GetTexImage(disp, dlsym(RTLD_DEFAULT, "glGetTexImage"));
-    SET_GetTexLevelParameterfv(disp, dlsym(RTLD_DEFAULT, "glGetTexLevelParameterfv"));
-    SET_GetTexLevelParameteriv(disp, dlsym(RTLD_DEFAULT, "glGetTexLevelParameteriv"));
-    SET_GetTexParameterfv(disp, dlsym(RTLD_DEFAULT, "glGetTexParameterfv"));
-    SET_GetTexParameteriv(disp, dlsym(RTLD_DEFAULT, "glGetTexParameteriv"));
-    SET_Hint(disp, dlsym(RTLD_DEFAULT, "glHint"));
-    SET_Histogram(disp, dlsym(RTLD_DEFAULT, "glHistogram"));
-    SET_IndexMask(disp, dlsym(RTLD_DEFAULT, "glIndexMask"));
-    SET_IndexPointer(disp, dlsym(RTLD_DEFAULT, "glIndexPointer"));
-    SET_Indexd(disp, dlsym(RTLD_DEFAULT, "glIndexd"));
-    SET_Indexdv(disp, dlsym(RTLD_DEFAULT, "glIndexdv"));
-    SET_Indexf(disp, dlsym(RTLD_DEFAULT, "glIndexf"));
-    SET_Indexfv(disp, dlsym(RTLD_DEFAULT, "glIndexfv"));
-    SET_Indexi(disp, dlsym(RTLD_DEFAULT, "glIndexi"));
-    SET_Indexiv(disp, dlsym(RTLD_DEFAULT, "glIndexiv"));
-    SET_Indexs(disp, dlsym(RTLD_DEFAULT, "glIndexs"));
-    SET_Indexsv(disp, dlsym(RTLD_DEFAULT, "glIndexsv"));
-    SET_Indexub(disp, dlsym(RTLD_DEFAULT, "glIndexub"));
-    SET_Indexubv(disp, dlsym(RTLD_DEFAULT, "glIndexubv"));
-    SET_InitNames(disp, dlsym(RTLD_DEFAULT, "glInitNames"));
-    SET_InterleavedArrays(disp, dlsym(RTLD_DEFAULT, "glInterleavedArrays"));
-    SET_IsEnabled(disp, dlsym(RTLD_DEFAULT, "glIsEnabled"));
-    SET_IsList(disp, dlsym(RTLD_DEFAULT, "glIsList"));
-    SET_IsTexture(disp, dlsym(RTLD_DEFAULT, "glIsTexture"));
-    SET_LightModelf(disp, dlsym(RTLD_DEFAULT, "glLightModelf"));
-    SET_LightModelfv(disp, dlsym(RTLD_DEFAULT, "glLightModelfv"));
-    SET_LightModeli(disp, dlsym(RTLD_DEFAULT, "glLightModeli"));
-    SET_LightModeliv(disp, dlsym(RTLD_DEFAULT, "glLightModeliv"));
-    SET_Lightf(disp, dlsym(RTLD_DEFAULT, "glLightf"));
-    SET_Lightfv(disp, dlsym(RTLD_DEFAULT, "glLightfv"));
-    SET_Lighti(disp, dlsym(RTLD_DEFAULT, "glLighti"));
-    SET_Lightiv(disp, dlsym(RTLD_DEFAULT, "glLightiv"));
-    SET_LineStipple(disp, dlsym(RTLD_DEFAULT, "glLineStipple"));
-    SET_LineWidth(disp, dlsym(RTLD_DEFAULT, "glLineWidth"));
-    SET_ListBase(disp, dlsym(RTLD_DEFAULT, "glListBase"));
-    SET_LoadIdentity(disp, dlsym(RTLD_DEFAULT, "glLoadIdentity"));
-    SET_LoadMatrixd(disp, dlsym(RTLD_DEFAULT, "glLoadMatrixd"));
-    SET_LoadMatrixf(disp, dlsym(RTLD_DEFAULT, "glLoadMatrixf"));
-    SET_LoadName(disp, dlsym(RTLD_DEFAULT, "glLoadName"));
-    SET_LogicOp(disp, dlsym(RTLD_DEFAULT, "glLogicOp"));
-    SET_Map1d(disp, dlsym(RTLD_DEFAULT, "glMap1d"));
-    SET_Map1f(disp, dlsym(RTLD_DEFAULT, "glMap1f"));
-    SET_Map2d(disp, dlsym(RTLD_DEFAULT, "glMap2d"));
-    SET_Map2f(disp, dlsym(RTLD_DEFAULT, "glMap2f"));
-    SET_MapGrid1d(disp, dlsym(RTLD_DEFAULT, "glMapGrid1d"));
-    SET_MapGrid1f(disp, dlsym(RTLD_DEFAULT, "glMapGrid1f"));
-    SET_MapGrid2d(disp, dlsym(RTLD_DEFAULT, "glMapGrid2d"));
-    SET_MapGrid2f(disp, dlsym(RTLD_DEFAULT, "glMapGrid2f"));
-    SET_Materialf(disp, dlsym(RTLD_DEFAULT, "glMaterialf"));
-    SET_Materialfv(disp, dlsym(RTLD_DEFAULT, "glMaterialfv"));
-    SET_Materiali(disp, dlsym(RTLD_DEFAULT, "glMateriali"));
-    SET_Materialiv(disp, dlsym(RTLD_DEFAULT, "glMaterialiv"));
-    SET_MatrixMode(disp, dlsym(RTLD_DEFAULT, "glMatrixMode"));
-    SET_Minmax(disp, dlsym(RTLD_DEFAULT, "glMinmax"));
-    SET_MultMatrixd(disp, dlsym(RTLD_DEFAULT, "glMultMatrixd"));
-    SET_MultMatrixf(disp, dlsym(RTLD_DEFAULT, "glMultMatrixf"));
-    SET_NewList(disp, dlsym(RTLD_DEFAULT, "glNewList"));
-    SET_Normal3b(disp, dlsym(RTLD_DEFAULT, "glNormal3b"));
-    SET_Normal3bv(disp, dlsym(RTLD_DEFAULT, "glNormal3bv"));
-    SET_Normal3d(disp, dlsym(RTLD_DEFAULT, "glNormal3d"));
-    SET_Normal3dv(disp, dlsym(RTLD_DEFAULT, "glNormal3dv"));
-    SET_Normal3f(disp, dlsym(RTLD_DEFAULT, "glNormal3f"));
-    SET_Normal3fv(disp, dlsym(RTLD_DEFAULT, "glNormal3fv"));
-    SET_Normal3i(disp, dlsym(RTLD_DEFAULT, "glNormal3i"));
-    SET_Normal3iv(disp, dlsym(RTLD_DEFAULT, "glNormal3iv"));
-    SET_Normal3s(disp, dlsym(RTLD_DEFAULT, "glNormal3s"));
-    SET_Normal3sv(disp, dlsym(RTLD_DEFAULT, "glNormal3sv"));
-    SET_NormalPointer(disp, dlsym(RTLD_DEFAULT, "glNormalPointer"));
-    SET_Ortho(disp, dlsym(RTLD_DEFAULT, "glOrtho"));
-    SET_PassThrough(disp, dlsym(RTLD_DEFAULT, "glPassThrough"));
-    SET_PixelMapfv(disp, dlsym(RTLD_DEFAULT, "glPixelMapfv"));
-    SET_PixelMapuiv(disp, dlsym(RTLD_DEFAULT, "glPixelMapuiv"));
-    SET_PixelMapusv(disp, dlsym(RTLD_DEFAULT, "glPixelMapusv"));
-    SET_PixelStoref(disp, dlsym(RTLD_DEFAULT, "glPixelStoref"));
-    SET_PixelStorei(disp, dlsym(RTLD_DEFAULT, "glPixelStorei"));
-    SET_PixelTransferf(disp, dlsym(RTLD_DEFAULT, "glPixelTransferf"));
-    SET_PixelTransferi(disp, dlsym(RTLD_DEFAULT, "glPixelTransferi"));
-    SET_PixelZoom(disp, dlsym(RTLD_DEFAULT, "glPixelZoom"));
-    SET_PointSize(disp, dlsym(RTLD_DEFAULT, "glPointSize"));
-    SET_PolygonMode(disp, dlsym(RTLD_DEFAULT, "glPolygonMode"));
-    SET_PolygonOffset(disp, dlsym(RTLD_DEFAULT, "glPolygonOffset"));
-    SET_PolygonStipple(disp, dlsym(RTLD_DEFAULT, "glPolygonStipple"));
-    SET_PopAttrib(disp, dlsym(RTLD_DEFAULT, "glPopAttrib"));
-    SET_PopClientAttrib(disp, dlsym(RTLD_DEFAULT, "glPopClientAttrib"));
-    SET_PopMatrix(disp, dlsym(RTLD_DEFAULT, "glPopMatrix"));
-    SET_PopName(disp, dlsym(RTLD_DEFAULT, "glPopName"));
-    SET_PrioritizeTextures(disp, dlsym(RTLD_DEFAULT, "glPrioritizeTextures"));
-    SET_PushAttrib(disp, dlsym(RTLD_DEFAULT, "glPushAttrib"));
-    SET_PushClientAttrib(disp, dlsym(RTLD_DEFAULT, "glPushClientAttrib"));
-    SET_PushMatrix(disp, dlsym(RTLD_DEFAULT, "glPushMatrix"));
-    SET_PushName(disp, dlsym(RTLD_DEFAULT, "glPushName"));
-    SET_RasterPos2d(disp, dlsym(RTLD_DEFAULT, "glRasterPos2d"));
-    SET_RasterPos2dv(disp, dlsym(RTLD_DEFAULT, "glRasterPos2dv"));
-    SET_RasterPos2f(disp, dlsym(RTLD_DEFAULT, "glRasterPos2f"));
-    SET_RasterPos2fv(disp, dlsym(RTLD_DEFAULT, "glRasterPos2fv"));
-    SET_RasterPos2i(disp, dlsym(RTLD_DEFAULT, "glRasterPos2i"));
-    SET_RasterPos2iv(disp, dlsym(RTLD_DEFAULT, "glRasterPos2iv"));
-    SET_RasterPos2s(disp, dlsym(RTLD_DEFAULT, "glRasterPos2s"));
-    SET_RasterPos2sv(disp, dlsym(RTLD_DEFAULT, "glRasterPos2sv"));
-    SET_RasterPos3d(disp, dlsym(RTLD_DEFAULT, "glRasterPos3d"));
-    SET_RasterPos3dv(disp, dlsym(RTLD_DEFAULT, "glRasterPos3dv"));
-    SET_RasterPos3f(disp, dlsym(RTLD_DEFAULT, "glRasterPos3f"));
-    SET_RasterPos3fv(disp, dlsym(RTLD_DEFAULT, "glRasterPos3fv"));
-    SET_RasterPos3i(disp, dlsym(RTLD_DEFAULT, "glRasterPos3i"));
-    SET_RasterPos3iv(disp, dlsym(RTLD_DEFAULT, "glRasterPos3iv"));
-    SET_RasterPos3s(disp, dlsym(RTLD_DEFAULT, "glRasterPos3s"));
-    SET_RasterPos3sv(disp, dlsym(RTLD_DEFAULT, "glRasterPos3sv"));
-    SET_RasterPos4d(disp, dlsym(RTLD_DEFAULT, "glRasterPos4d"));
-    SET_RasterPos4dv(disp, dlsym(RTLD_DEFAULT, "glRasterPos4dv"));
-    SET_RasterPos4f(disp, dlsym(RTLD_DEFAULT, "glRasterPos4f"));
-    SET_RasterPos4fv(disp, dlsym(RTLD_DEFAULT, "glRasterPos4fv"));
-    SET_RasterPos4i(disp, dlsym(RTLD_DEFAULT, "glRasterPos4i"));
-    SET_RasterPos4iv(disp, dlsym(RTLD_DEFAULT, "glRasterPos4iv"));
-    SET_RasterPos4s(disp, dlsym(RTLD_DEFAULT, "glRasterPos4s"));
-    SET_RasterPos4sv(disp, dlsym(RTLD_DEFAULT, "glRasterPos4sv"));
-    SET_ReadBuffer(disp, dlsym(RTLD_DEFAULT, "glReadBuffer"));
-    SET_ReadPixels(disp, dlsym(RTLD_DEFAULT, "glReadPixels"));
-    SET_Rectd(disp, dlsym(RTLD_DEFAULT, "glRectd"));
-    SET_Rectdv(disp, dlsym(RTLD_DEFAULT, "glRectdv"));
-    SET_Rectf(disp, dlsym(RTLD_DEFAULT, "glRectf"));
-    SET_Rectfv(disp, dlsym(RTLD_DEFAULT, "glRectfv"));
-    SET_Recti(disp, dlsym(RTLD_DEFAULT, "glRecti"));
-    SET_Rectiv(disp, dlsym(RTLD_DEFAULT, "glRectiv"));
-    SET_Rects(disp, dlsym(RTLD_DEFAULT, "glRects"));
-    SET_Rectsv(disp, dlsym(RTLD_DEFAULT, "glRectsv"));
-    SET_RenderMode(disp, dlsym(RTLD_DEFAULT, "glRenderMode"));
-    SET_ResetHistogram(disp, dlsym(RTLD_DEFAULT, "glResetHistogram"));
-    SET_ResetMinmax(disp, dlsym(RTLD_DEFAULT, "glResetMinmax"));
-    SET_Rotated(disp, dlsym(RTLD_DEFAULT, "glRotated"));
-    SET_Rotatef(disp, dlsym(RTLD_DEFAULT, "glRotatef"));
-    SET_Scaled(disp, dlsym(RTLD_DEFAULT, "glScaled"));
-    SET_Scalef(disp, dlsym(RTLD_DEFAULT, "glScalef"));
-    SET_Scissor(disp, dlsym(RTLD_DEFAULT, "glScissor"));
-    SET_SelectBuffer(disp, dlsym(RTLD_DEFAULT, "glSelectBuffer"));
-    SET_SeparableFilter2D(disp, dlsym(RTLD_DEFAULT, "glSeparableFilter2D"));
-    SET_ShadeModel(disp, dlsym(RTLD_DEFAULT, "glShadeModel"));
-    SET_StencilFunc(disp, dlsym(RTLD_DEFAULT, "glStencilFunc"));
-    SET_StencilMask(disp, dlsym(RTLD_DEFAULT, "glStencilMask"));
-    SET_StencilOp(disp, dlsym(RTLD_DEFAULT, "glStencilOp"));
-    SET_TexCoord1d(disp, dlsym(RTLD_DEFAULT, "glTexCoord1d"));
-    SET_TexCoord1dv(disp, dlsym(RTLD_DEFAULT, "glTexCoord1dv"));
-    SET_TexCoord1f(disp, dlsym(RTLD_DEFAULT, "glTexCoord1f"));
-    SET_TexCoord1fv(disp, dlsym(RTLD_DEFAULT, "glTexCoord1fv"));
-    SET_TexCoord1i(disp, dlsym(RTLD_DEFAULT, "glTexCoord1i"));
-    SET_TexCoord1iv(disp, dlsym(RTLD_DEFAULT, "glTexCoord1iv"));
-    SET_TexCoord1s(disp, dlsym(RTLD_DEFAULT, "glTexCoord1s"));
-    SET_TexCoord1sv(disp, dlsym(RTLD_DEFAULT, "glTexCoord1sv"));
-    SET_TexCoord2d(disp, dlsym(RTLD_DEFAULT, "glTexCoord2d"));
-    SET_TexCoord2dv(disp, dlsym(RTLD_DEFAULT, "glTexCoord2dv"));
-    SET_TexCoord2f(disp, dlsym(RTLD_DEFAULT, "glTexCoord2f"));
-    SET_TexCoord2fv(disp, dlsym(RTLD_DEFAULT, "glTexCoord2fv"));
-    SET_TexCoord2i(disp, dlsym(RTLD_DEFAULT, "glTexCoord2i"));
-    SET_TexCoord2iv(disp, dlsym(RTLD_DEFAULT, "glTexCoord2iv"));
-    SET_TexCoord2s(disp, dlsym(RTLD_DEFAULT, "glTexCoord2s"));
-    SET_TexCoord2sv(disp, dlsym(RTLD_DEFAULT, "glTexCoord2sv"));
-    SET_TexCoord3d(disp, dlsym(RTLD_DEFAULT, "glTexCoord3d"));
-    SET_TexCoord3dv(disp, dlsym(RTLD_DEFAULT, "glTexCoord3dv"));
-    SET_TexCoord3f(disp, dlsym(RTLD_DEFAULT, "glTexCoord3f"));
-    SET_TexCoord3fv(disp, dlsym(RTLD_DEFAULT, "glTexCoord3fv"));
-    SET_TexCoord3i(disp, dlsym(RTLD_DEFAULT, "glTexCoord3i"));
-    SET_TexCoord3iv(disp, dlsym(RTLD_DEFAULT, "glTexCoord3iv"));
-    SET_TexCoord3s(disp, dlsym(RTLD_DEFAULT, "glTexCoord3s"));
-    SET_TexCoord3sv(disp, dlsym(RTLD_DEFAULT, "glTexCoord3sv"));
-    SET_TexCoord4d(disp, dlsym(RTLD_DEFAULT, "glTexCoord4d"));
-    SET_TexCoord4dv(disp, dlsym(RTLD_DEFAULT, "glTexCoord4dv"));
-    SET_TexCoord4f(disp, dlsym(RTLD_DEFAULT, "glTexCoord4f"));
-    SET_TexCoord4fv(disp, dlsym(RTLD_DEFAULT, "glTexCoord4fv"));
-    SET_TexCoord4i(disp, dlsym(RTLD_DEFAULT, "glTexCoord4i"));
-    SET_TexCoord4iv(disp, dlsym(RTLD_DEFAULT, "glTexCoord4iv"));
-    SET_TexCoord4s(disp, dlsym(RTLD_DEFAULT, "glTexCoord4s"));
-    SET_TexCoord4sv(disp, dlsym(RTLD_DEFAULT, "glTexCoord4sv"));
-    SET_TexCoordPointer(disp, dlsym(RTLD_DEFAULT, "glTexCoordPointer"));
-    SET_TexEnvf(disp, dlsym(RTLD_DEFAULT, "glTexEnvf"));
-    SET_TexEnvfv(disp, dlsym(RTLD_DEFAULT, "glTexEnvfv"));
-    SET_TexEnvi(disp, dlsym(RTLD_DEFAULT, "glTexEnvi"));
-    SET_TexEnviv(disp, dlsym(RTLD_DEFAULT, "glTexEnviv"));
-    SET_TexGend(disp, dlsym(RTLD_DEFAULT, "glTexGend"));
-    SET_TexGendv(disp, dlsym(RTLD_DEFAULT, "glTexGendv"));
-    SET_TexGenf(disp, dlsym(RTLD_DEFAULT, "glTexGenf"));
-    SET_TexGenfv(disp, dlsym(RTLD_DEFAULT, "glTexGenfv"));
-    SET_TexGeni(disp, dlsym(RTLD_DEFAULT, "glTexGeni"));
-    SET_TexGeniv(disp, dlsym(RTLD_DEFAULT, "glTexGeniv"));
-    
-    /* Pointer Incompatability:
-     * internalformat is a GLenum according to /System/Library/Frameworks/OpenGL.framework/Headers/gl.h
-     * extern void glTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-     * extern void glTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-     * extern void glTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-     *
-     * and it's a GLint in glx/glapitable.h and according to the man page
-     * void ( * TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels);
-     * void ( * TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels);
-     * void ( * TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels);
-     *
-     * <rdar://problem/6953344> gl.h contains incorrect prototypes for glTexImage[123]D
-     */
-    
-    SET_TexImage1D(disp, dlsym(RTLD_DEFAULT, "glTexImage1D"));
-    SET_TexImage2D(disp, dlsym(RTLD_DEFAULT, "glTexImage2D"));
-    SET_TexImage3D(disp, dlsym(RTLD_DEFAULT, "glTexImage3D"));
-    SET_TexParameterf(disp, dlsym(RTLD_DEFAULT, "glTexParameterf"));
-    SET_TexParameterfv(disp, dlsym(RTLD_DEFAULT, "glTexParameterfv"));
-    SET_TexParameteri(disp, dlsym(RTLD_DEFAULT, "glTexParameteri"));
-    SET_TexParameteriv(disp, dlsym(RTLD_DEFAULT, "glTexParameteriv"));
-    SET_TexSubImage1D(disp, dlsym(RTLD_DEFAULT, "glTexSubImage1D"));
-    SET_TexSubImage2D(disp, dlsym(RTLD_DEFAULT, "glTexSubImage2D"));
-    SET_TexSubImage3D(disp, dlsym(RTLD_DEFAULT, "glTexSubImage3D"));
-    SET_Translated(disp, dlsym(RTLD_DEFAULT, "glTranslated"));
-    SET_Translatef(disp, dlsym(RTLD_DEFAULT, "glTranslatef"));
-    SET_Vertex2d(disp, dlsym(RTLD_DEFAULT, "glVertex2d"));
-    SET_Vertex2dv(disp, dlsym(RTLD_DEFAULT, "glVertex2dv"));
-    SET_Vertex2f(disp, dlsym(RTLD_DEFAULT, "glVertex2f"));
-    SET_Vertex2fv(disp, dlsym(RTLD_DEFAULT, "glVertex2fv"));
-    SET_Vertex2i(disp, dlsym(RTLD_DEFAULT, "glVertex2i"));
-    SET_Vertex2iv(disp, dlsym(RTLD_DEFAULT, "glVertex2iv"));
-    SET_Vertex2s(disp, dlsym(RTLD_DEFAULT, "glVertex2s"));
-    SET_Vertex2sv(disp, dlsym(RTLD_DEFAULT, "glVertex2sv"));
-    SET_Vertex3d(disp, dlsym(RTLD_DEFAULT, "glVertex3d"));
-    SET_Vertex3dv(disp, dlsym(RTLD_DEFAULT, "glVertex3dv"));
-    SET_Vertex3f(disp, dlsym(RTLD_DEFAULT, "glVertex3f"));
-    SET_Vertex3fv(disp, dlsym(RTLD_DEFAULT, "glVertex3fv"));
-    SET_Vertex3i(disp, dlsym(RTLD_DEFAULT, "glVertex3i"));
-    SET_Vertex3iv(disp, dlsym(RTLD_DEFAULT, "glVertex3iv"));
-    SET_Vertex3s(disp, dlsym(RTLD_DEFAULT, "glVertex3s"));
-    SET_Vertex3sv(disp, dlsym(RTLD_DEFAULT, "glVertex3sv"));
-    SET_Vertex4d(disp, dlsym(RTLD_DEFAULT, "glVertex4d"));
-    SET_Vertex4dv(disp, dlsym(RTLD_DEFAULT, "glVertex4dv"));
-    SET_Vertex4f(disp, dlsym(RTLD_DEFAULT, "glVertex4f"));
-    SET_Vertex4fv(disp, dlsym(RTLD_DEFAULT, "glVertex4fv"));
-    SET_Vertex4i(disp, dlsym(RTLD_DEFAULT, "glVertex4i"));
-    SET_Vertex4iv(disp, dlsym(RTLD_DEFAULT, "glVertex4iv"));
-    SET_Vertex4s(disp, dlsym(RTLD_DEFAULT, "glVertex4s"));
-    SET_Vertex4sv(disp, dlsym(RTLD_DEFAULT, "glVertex4sv"));
-    SET_VertexPointer(disp, dlsym(RTLD_DEFAULT, "glVertexPointer"));
-    SET_Viewport(disp, dlsym(RTLD_DEFAULT, "glViewport"));
-
-    /* GL_VERSION_2_0 */
-    SET_AttachShader(disp, dlsym(RTLD_DEFAULT, "glAttachShader"));
-    SET_DeleteShader(disp, dlsym(RTLD_DEFAULT, "glDeleteShader"));
-    SET_DetachShader(disp, dlsym(RTLD_DEFAULT, "glDetachShader"));
-    SET_GetAttachedShaders(disp, dlsym(RTLD_DEFAULT, "glGetAttachedShaders"));
-    SET_GetProgramInfoLog(disp, dlsym(RTLD_DEFAULT, "glGetProgramInfoLog"));
-    SET_GetShaderInfoLog(disp, dlsym(RTLD_DEFAULT, "glGetShaderInfoLog"));
-    SET_GetShaderiv(disp, dlsym(RTLD_DEFAULT, "glGetShaderiv"));
-    SET_IsShader(disp, dlsym(RTLD_DEFAULT, "glIsShader"));
-    SET_StencilFuncSeparate(disp, dlsym(RTLD_DEFAULT, "glStencilFuncSeparate"));
-    SET_StencilMaskSeparate(disp, dlsym(RTLD_DEFAULT, "glStencilMaskSeparate"));
-    SET_StencilOpSeparate(disp, dlsym(RTLD_DEFAULT, "glStencilOpSeparate"));
-
-    /* GL_VERSION_2_1 */
-    SET_UniformMatrix2x3fv(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix2x3fv"));
-    SET_UniformMatrix2x4fv(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix2x4fv"));
-    SET_UniformMatrix3x2fv(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix3x2fv"));
-    SET_UniformMatrix3x4fv(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix3x4fv"));
-    SET_UniformMatrix4x2fv(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix4x2fv"));
-    SET_UniformMatrix4x3fv(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix4x3fv"));
-
-    /* GL_APPLE_vertex_array_object */
-    SET_BindVertexArrayAPPLE(disp, dlsym(RTLD_DEFAULT, "glBindVertexArrayAPPLE"));
-    SET_DeleteVertexArraysAPPLE(disp, dlsym(RTLD_DEFAULT, "glDeleteVertexArraysAPPLE"));
-    SET_GenVertexArraysAPPLE(disp, dlsym(RTLD_DEFAULT, "glGenVertexArraysAPPLE"));
-    SET_IsVertexArrayAPPLE(disp, dlsym(RTLD_DEFAULT, "glIsVertexArrayAPPLE"));
-
-    /* GL_ARB_draw_buffers */
-    SET_DrawBuffersARB(disp, dlsym(RTLD_DEFAULT, "glDrawBuffersARB"));
-
-    /* GL_ARB_multisample */
-    SET_SampleCoverageARB(disp, dlsym(RTLD_DEFAULT, "glSampleCoverageARB"));
-
-    /* GL_ARB_multitexture */
-    SET_ActiveTextureARB(disp, dlsym(RTLD_DEFAULT, "glActiveTextureARB"));
-    SET_ClientActiveTextureARB(disp, dlsym(RTLD_DEFAULT, "glClientActiveTextureARB"));
-    SET_MultiTexCoord1dARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1dARB"));
-    SET_MultiTexCoord1dvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1dvARB"));
-    SET_MultiTexCoord1fARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1fARB"));
-    SET_MultiTexCoord1fvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1fvARB"));
-    SET_MultiTexCoord1iARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1iARB"));
-    SET_MultiTexCoord1ivARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1ivARB"));
-    SET_MultiTexCoord1sARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1sARB"));
-    SET_MultiTexCoord1svARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1svARB"));
-    SET_MultiTexCoord2dARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2dARB"));
-    SET_MultiTexCoord2dvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2dvARB"));
-    SET_MultiTexCoord2fARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2fARB"));
-    SET_MultiTexCoord2fvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2fvARB"));
-    SET_MultiTexCoord2iARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2iARB"));
-    SET_MultiTexCoord2ivARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2ivARB"));
-    SET_MultiTexCoord2sARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2sARB"));
-    SET_MultiTexCoord2svARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2svARB"));
-    SET_MultiTexCoord3dARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3dARB"));
-    SET_MultiTexCoord3dvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3dvARB"));
-    SET_MultiTexCoord3fARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3fARB"));
-    SET_MultiTexCoord3fvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3fvARB"));
-    SET_MultiTexCoord3iARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3iARB"));
-    SET_MultiTexCoord3ivARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3ivARB"));
-    SET_MultiTexCoord3sARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3sARB"));
-    SET_MultiTexCoord3svARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3svARB"));
-    SET_MultiTexCoord4dARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4dARB"));
-    SET_MultiTexCoord4dvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4dvARB"));
-    SET_MultiTexCoord4fARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4fARB"));
-    SET_MultiTexCoord4fvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4fvARB"));
-    SET_MultiTexCoord4iARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4iARB"));
-    SET_MultiTexCoord4ivARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4ivARB"));
-    SET_MultiTexCoord4sARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4sARB"));
-    SET_MultiTexCoord4svARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4svARB"));
-
-    /* GL_ARB_occlusion_query */
-    SET_BeginQueryARB(disp, dlsym(RTLD_DEFAULT, "glBeginQueryARB"));
-    SET_DeleteQueriesARB(disp, dlsym(RTLD_DEFAULT, "glDeleteQueriesARB"));
-    SET_EndQueryARB(disp, dlsym(RTLD_DEFAULT, "glEndQueryARB"));
-    SET_GenQueriesARB(disp, dlsym(RTLD_DEFAULT, "glGenQueriesARB"));
-    SET_GetQueryObjectivARB(disp, dlsym(RTLD_DEFAULT, "glGetQueryObjectivARB"));
-    SET_GetQueryObjectuivARB(disp, dlsym(RTLD_DEFAULT, "glGetQueryObjectuivARB"));
-    SET_GetQueryivARB(disp, dlsym(RTLD_DEFAULT, "glGetQueryivARB"));
-    SET_IsQueryARB(disp, dlsym(RTLD_DEFAULT, "glIsQueryARB"));
-
-    /* GL_ARB_shader_objects */
-    SET_AttachObjectARB(disp, dlsym(RTLD_DEFAULT, "glAttachObjectARB"));
-    SET_CompileShaderARB(disp, dlsym(RTLD_DEFAULT, "glCompileShaderARB"));
-    SET_DeleteObjectARB(disp, dlsym(RTLD_DEFAULT, "glDeleteObjectARB"));
-    SET_GetHandleARB(disp, dlsym(RTLD_DEFAULT, "glGetHandleARB"));
-    SET_DetachObjectARB(disp, dlsym(RTLD_DEFAULT, "glDetachObjectARB"));
-    SET_CreateProgramObjectARB(disp, dlsym(RTLD_DEFAULT, "glCreateProgramObjectARB"));
-    SET_CreateShaderObjectARB(disp, dlsym(RTLD_DEFAULT, "glCreateShaderObjectARB"));
-    SET_GetInfoLogARB(disp, dlsym(RTLD_DEFAULT, "glGetInfoLogARB"));
-    SET_GetActiveUniformARB(disp, dlsym(RTLD_DEFAULT, "glGetActiveUniformARB"));
-    SET_GetAttachedObjectsARB(disp, dlsym(RTLD_DEFAULT, "glGetAttachedObjectsARB"));
-    SET_GetObjectParameterfvARB(disp, dlsym(RTLD_DEFAULT, "glGetObjectParameterfvARB"));
-    SET_GetObjectParameterivARB(disp, dlsym(RTLD_DEFAULT, "glGetObjectParameterivARB"));
-    SET_GetShaderSourceARB(disp, dlsym(RTLD_DEFAULT, "glGetShaderSourceARB"));
-    SET_GetUniformLocationARB(disp, dlsym(RTLD_DEFAULT, "glGetUniformLocationARB"));
-    SET_GetUniformfvARB(disp, dlsym(RTLD_DEFAULT, "glGetUniformfvARB"));
-    SET_GetUniformivARB(disp, dlsym(RTLD_DEFAULT, "glGetUniformivARB"));
-    SET_LinkProgramARB(disp, dlsym(RTLD_DEFAULT, "glLinkProgramARB"));
-    SET_ShaderSourceARB(disp, dlsym(RTLD_DEFAULT, "glShaderSourceARB"));
-    SET_Uniform1fARB(disp, dlsym(RTLD_DEFAULT, "glUniform1fARB"));
-    SET_Uniform1fvARB(disp, dlsym(RTLD_DEFAULT, "glUniform1fvARB"));
-    SET_Uniform1iARB(disp, dlsym(RTLD_DEFAULT, "glUniform1iARB"));
-    SET_Uniform1ivARB(disp, dlsym(RTLD_DEFAULT, "glUniform1ivARB"));
-    SET_Uniform2fARB(disp, dlsym(RTLD_DEFAULT, "glUniform2fARB"));
-    SET_Uniform2fvARB(disp, dlsym(RTLD_DEFAULT, "glUniform2fvARB"));
-    SET_Uniform2iARB(disp, dlsym(RTLD_DEFAULT, "glUniform2iARB"));
-    SET_Uniform2ivARB(disp, dlsym(RTLD_DEFAULT, "glUniform2ivARB"));
-    SET_Uniform3fARB(disp, dlsym(RTLD_DEFAULT, "glUniform3fARB"));
-    SET_Uniform3fvARB(disp, dlsym(RTLD_DEFAULT, "glUniform3fvARB"));
-    SET_Uniform3iARB(disp, dlsym(RTLD_DEFAULT, "glUniform3iARB"));
-    SET_Uniform3ivARB(disp, dlsym(RTLD_DEFAULT, "glUniform3ivARB"));
-    SET_Uniform4fARB(disp, dlsym(RTLD_DEFAULT, "glUniform4fARB"));
-    SET_Uniform4fvARB(disp, dlsym(RTLD_DEFAULT, "glUniform4fvARB"));
-    SET_Uniform4iARB(disp, dlsym(RTLD_DEFAULT, "glUniform4iARB"));
-    SET_Uniform4ivARB(disp, dlsym(RTLD_DEFAULT, "glUniform4ivARB"));
-    SET_UniformMatrix2fvARB(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix2fvARB"));
-    SET_UniformMatrix3fvARB(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix3fvARB"));
-    SET_UniformMatrix4fvARB(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix4fvARB"));
-    SET_UseProgramObjectARB(disp, dlsym(RTLD_DEFAULT, "glUseProgramObjectARB"));
-    SET_ValidateProgramARB(disp, dlsym(RTLD_DEFAULT, "glValidateProgramARB"));
-
-    /* GL_ARB_texture_compression */
-    SET_CompressedTexImage1DARB(disp, dlsym(RTLD_DEFAULT, "glCompressedTexImage1DARB"));
-    SET_CompressedTexImage2DARB(disp, dlsym(RTLD_DEFAULT, "glCompressedTexImage2DARB"));
-    SET_CompressedTexImage3DARB(disp, dlsym(RTLD_DEFAULT, "glCompressedTexImage3DARB"));
-    SET_CompressedTexSubImage1DARB(disp, dlsym(RTLD_DEFAULT, "glCompressedTexSubImage1DARB"));
-    SET_CompressedTexSubImage2DARB(disp, dlsym(RTLD_DEFAULT, "glCompressedTexSubImage2DARB"));
-    SET_CompressedTexSubImage3DARB(disp, dlsym(RTLD_DEFAULT, "glCompressedTexSubImage3DARB"));
-    SET_GetCompressedTexImageARB(disp, dlsym(RTLD_DEFAULT, "glGetCompressedTexImageARB"));
-
-    /* GL_ARB_transpose_matrix */
-    SET_LoadTransposeMatrixdARB(disp, dlsym(RTLD_DEFAULT, "glLoadTransposeMatrixdARB"));
-    SET_LoadTransposeMatrixfARB(disp, dlsym(RTLD_DEFAULT, "glLoadTransposeMatrixfARB"));
-    SET_MultTransposeMatrixdARB(disp, dlsym(RTLD_DEFAULT, "glMultTransposeMatrixdARB"));
-    SET_MultTransposeMatrixfARB(disp, dlsym(RTLD_DEFAULT, "glMultTransposeMatrixfARB"));
-
-    /* GL_ARB_vertex_buffer_object */
-    SET_BindBufferARB(disp, dlsym(RTLD_DEFAULT, "glBindBufferARB"));
-    SET_BufferDataARB(disp, dlsym(RTLD_DEFAULT, "glBufferDataARB"));
-    SET_BufferSubDataARB(disp, dlsym(RTLD_DEFAULT, "glBufferSubDataARB"));
-    SET_DeleteBuffersARB(disp, dlsym(RTLD_DEFAULT, "glDeleteBuffersARB"));
-    SET_GenBuffersARB(disp, dlsym(RTLD_DEFAULT, "glGenBuffersARB"));
-    SET_GetBufferParameterivARB(disp, dlsym(RTLD_DEFAULT, "glGetBufferParameterivARB"));
-    SET_GetBufferPointervARB(disp, dlsym(RTLD_DEFAULT, "glGetBufferPointervARB"));
-    SET_GetBufferSubDataARB(disp, dlsym(RTLD_DEFAULT, "glGetBufferSubDataARB"));
-    SET_IsBufferARB(disp, dlsym(RTLD_DEFAULT, "glIsBufferARB"));
-    SET_MapBufferARB(disp, dlsym(RTLD_DEFAULT, "glMapBufferARB"));
-    SET_UnmapBufferARB(disp, dlsym(RTLD_DEFAULT, "glUnmapBufferARB"));
-
-    /* GL_ARB_vertex_program */
-    SET_DisableVertexAttribArrayARB(disp, dlsym(RTLD_DEFAULT, "glDisableVertexAttribArrayARB"));
-    SET_EnableVertexAttribArrayARB(disp, dlsym(RTLD_DEFAULT, "glEnableVertexAttribArrayARB"));
-    SET_GetProgramEnvParameterdvARB(disp, dlsym(RTLD_DEFAULT, "glGetProgramEnvParameterdvARB"));
-    SET_GetProgramEnvParameterfvARB(disp, dlsym(RTLD_DEFAULT, "glGetProgramEnvParameterfvARB"));
-    SET_GetProgramLocalParameterdvARB(disp, dlsym(RTLD_DEFAULT, "glGetProgramLocalParameterdvARB"));
-    SET_GetProgramLocalParameterfvARB(disp, dlsym(RTLD_DEFAULT, "glGetProgramLocalParameterfvARB"));
-    SET_GetProgramStringARB(disp, dlsym(RTLD_DEFAULT, "glGetProgramStringARB"));
-    SET_GetProgramivARB(disp, dlsym(RTLD_DEFAULT, "glGetProgramivARB"));
-    SET_GetVertexAttribdvARB(disp, dlsym(RTLD_DEFAULT, "glGetVertexAttribdvARB"));
-    SET_GetVertexAttribfvARB(disp, dlsym(RTLD_DEFAULT, "glGetVertexAttribfvARB"));
-    SET_GetVertexAttribivARB(disp, dlsym(RTLD_DEFAULT, "glGetVertexAttribivARB"));
-    SET_ProgramEnvParameter4dARB(disp, dlsym(RTLD_DEFAULT, "glProgramEnvParameter4dARB"));
-    SET_ProgramEnvParameter4dvARB(disp, dlsym(RTLD_DEFAULT, "glProgramEnvParameter4dvARB"));
-    SET_ProgramEnvParameter4fARB(disp, dlsym(RTLD_DEFAULT, "glProgramEnvParameter4fARB"));
-    SET_ProgramEnvParameter4fvARB(disp, dlsym(RTLD_DEFAULT, "glProgramEnvParameter4fvARB"));
-    SET_ProgramLocalParameter4dARB(disp, dlsym(RTLD_DEFAULT, "glProgramLocalParameter4dARB"));
-    SET_ProgramLocalParameter4dvARB(disp, dlsym(RTLD_DEFAULT, "glProgramLocalParameter4dvARB"));
-    SET_ProgramLocalParameter4fARB(disp, dlsym(RTLD_DEFAULT, "glProgramLocalParameter4fARB"));
-    SET_ProgramLocalParameter4fvARB(disp, dlsym(RTLD_DEFAULT, "glProgramLocalParameter4fvARB"));
-    SET_ProgramStringARB(disp, dlsym(RTLD_DEFAULT, "glProgramStringARB"));
-    SET_VertexAttrib1dARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1dARB"));
-    SET_VertexAttrib1dvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1dvARB"));
-    SET_VertexAttrib1fARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1fARB"));
-    SET_VertexAttrib1fvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1fvARB"));
-    SET_VertexAttrib1sARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1sARB"));
-    SET_VertexAttrib1svARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1svARB"));
-    SET_VertexAttrib2dARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2dARB"));
-    SET_VertexAttrib2dvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2dvARB"));
-    SET_VertexAttrib2fARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2fARB"));
-    SET_VertexAttrib2fvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2fvARB"));
-    SET_VertexAttrib2sARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2sARB"));
-    SET_VertexAttrib2svARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2svARB"));
-    SET_VertexAttrib3dARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3dARB"));
-    SET_VertexAttrib3dvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3dvARB"));
-    SET_VertexAttrib3fARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3fARB"));
-    SET_VertexAttrib3fvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3fvARB"));
-    SET_VertexAttrib3sARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3sARB"));
-    SET_VertexAttrib3svARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3svARB"));
-    SET_VertexAttrib4NbvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4NbvARB"));
-    SET_VertexAttrib4NivARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4NivARB"));
-    SET_VertexAttrib4NsvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4NsvARB"));
-    SET_VertexAttrib4NubARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4NubARB"));
-    SET_VertexAttrib4NubvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4NubvARB"));
-    SET_VertexAttrib4NuivARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4NuivARB"));
-    SET_VertexAttrib4NusvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4NusvARB"));
-    SET_VertexAttrib4bvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4bvARB"));
-    SET_VertexAttrib4dARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4dARB"));
-    SET_VertexAttrib4dvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4dvARB"));
-    SET_VertexAttrib4fARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4fARB"));
-    SET_VertexAttrib4fvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4fvARB"));
-    SET_VertexAttrib4ivARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4ivARB"));
-    SET_VertexAttrib4sARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4sARB"));
-    SET_VertexAttrib4svARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4svARB"));
-    SET_VertexAttrib4ubvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4ubvARB"));
-    SET_VertexAttrib4uivARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4uivARB"));
-    SET_VertexAttrib4usvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4usvARB"));
-    SET_VertexAttribPointerARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttribPointerARB"));
-
-    /* GL_ARB_vertex_shader */
-    SET_BindAttribLocationARB(disp, dlsym(RTLD_DEFAULT, "glBindAttribLocationARB"));
-    SET_GetActiveAttribARB(disp, dlsym(RTLD_DEFAULT, "glGetActiveAttribARB"));
-    SET_GetAttribLocationARB(disp, dlsym(RTLD_DEFAULT, "glGetAttribLocationARB"));
-
-    /* GL_ARB_window_pos */
-    SET_WindowPos2dMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2dARB"));
-    SET_WindowPos2dvMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2dvARB"));
-    SET_WindowPos2fMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2fARB"));
-    SET_WindowPos2fvMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2fvARB"));
-    SET_WindowPos2iMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2iARB"));
-    SET_WindowPos2ivMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2ivARB"));
-    SET_WindowPos2sMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2sARB"));
-    SET_WindowPos2svMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2svARB"));
-    SET_WindowPos3dMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3dARB"));
-    SET_WindowPos3dvMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3dvARB"));
-    SET_WindowPos3fMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3fARB"));
-    SET_WindowPos3fvMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3fvARB"));
-    SET_WindowPos3iMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3iARB"));
-    SET_WindowPos3ivMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3ivARB"));
-    SET_WindowPos3sMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3sARB"));
-    SET_WindowPos3svMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3svARB"));
-
-    /* GL_ATI_fragment_shader / GL_EXT_fragment_shader */
-    if(dlsym(RTLD_DEFAULT, "glAlphaFragmentOp1ATI")) {
-        /* GL_ATI_fragment_shader */
-        SET_AlphaFragmentOp1ATI(disp, dlsym(RTLD_DEFAULT, "glAlphaFragmentOp1ATI"));
-        SET_AlphaFragmentOp2ATI(disp, dlsym(RTLD_DEFAULT, "glAlphaFragmentOp2ATI"));
-        SET_AlphaFragmentOp3ATI(disp, dlsym(RTLD_DEFAULT, "glAlphaFragmentOp3ATI"));
-        SET_BeginFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glBeginFragmentShaderATI"));
-        SET_BindFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glBindFragmentShaderATI"));
-        SET_ColorFragmentOp1ATI(disp, dlsym(RTLD_DEFAULT, "glColorFragmentOp1ATI"));
-        SET_ColorFragmentOp2ATI(disp, dlsym(RTLD_DEFAULT, "glColorFragmentOp2ATI"));
-        SET_ColorFragmentOp3ATI(disp, dlsym(RTLD_DEFAULT, "glColorFragmentOp3ATI"));
-        SET_DeleteFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glDeleteFragmentShaderATI"));
-        SET_EndFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glEndFragmentShaderATI"));
-        SET_GenFragmentShadersATI(disp, dlsym(RTLD_DEFAULT, "glGenFragmentShadersATI"));
-        SET_PassTexCoordATI(disp, dlsym(RTLD_DEFAULT, "glPassTexCoordATI"));
-        SET_SampleMapATI(disp, dlsym(RTLD_DEFAULT, "glSampleMapATI"));
-        SET_SetFragmentShaderConstantATI(disp, dlsym(RTLD_DEFAULT, "glSetFragmentShaderConstantATI"));
-    } else {
-        /* GL_EXT_fragment_shader */
-        SET_AlphaFragmentOp1ATI(disp, dlsym(RTLD_DEFAULT, "glAlphaFragmentOp1EXT"));
-        SET_AlphaFragmentOp2ATI(disp, dlsym(RTLD_DEFAULT, "glAlphaFragmentOp2EXT"));
-        SET_AlphaFragmentOp3ATI(disp, dlsym(RTLD_DEFAULT, "glAlphaFragmentOp3EXT"));
-        SET_BeginFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glBeginFragmentShaderEXT"));
-        SET_BindFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glBindFragmentShaderEXT"));
-        SET_ColorFragmentOp1ATI(disp, dlsym(RTLD_DEFAULT, "glColorFragmentOp1EXT"));
-        SET_ColorFragmentOp2ATI(disp, dlsym(RTLD_DEFAULT, "glColorFragmentOp2EXT"));
-        SET_ColorFragmentOp3ATI(disp, dlsym(RTLD_DEFAULT, "glColorFragmentOp3EXT"));
-        SET_DeleteFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glDeleteFragmentShaderEXT"));
-        SET_EndFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glEndFragmentShaderEXT"));
-        SET_GenFragmentShadersATI(disp, dlsym(RTLD_DEFAULT, "glGenFragmentShadersEXT"));
-        SET_PassTexCoordATI(disp, dlsym(RTLD_DEFAULT, "glPassTexCoordEXT"));
-        SET_SampleMapATI(disp, dlsym(RTLD_DEFAULT, "glSampleMapEXT"));
-        SET_SetFragmentShaderConstantATI(disp, dlsym(RTLD_DEFAULT, "glSetFragmentShaderConstantEXT"));
+    opengl_framework_path = getenv("OPENGL_FRAMEWORK_PATH");
+    if (!opengl_framework_path) {
+        opengl_framework_path = OPENGL_FRAMEWORK_PATH;
     }
 
-    /* GL_ATI_separate_stencil */
-    SET_StencilFuncSeparateATI(disp, dlsym(RTLD_DEFAULT, "glStencilFuncSeparateATI"));
-
-    /* GL_EXT_blend_equation_separate */
-    SET_BlendEquationSeparateEXT(disp, dlsym(RTLD_DEFAULT, "glBlendEquationSeparateEXT"));
-
-    /* GL_EXT_blend_func_separate */
-    SET_BlendFuncSeparateEXT(disp, dlsym(RTLD_DEFAULT, "glBlendFuncSeparateEXT"));
-
-    /* GL_EXT_depth_bounds_test */
-    SET_DepthBoundsEXT(disp, dlsym(RTLD_DEFAULT, "glDepthBoundsEXT"));
-
-    /* GL_EXT_compiled_vertex_array */
-    SET_LockArraysEXT(disp, dlsym(RTLD_DEFAULT, "glLockArraysEXT"));
-    SET_UnlockArraysEXT(disp, dlsym(RTLD_DEFAULT, "glUnlockArraysEXT"));
-
-    /* GL_EXT_cull_vertex */
-    SET_CullParameterdvEXT(disp, dlsym(RTLD_DEFAULT, "glCullParameterdvEXT"));
-    SET_CullParameterfvEXT(disp, dlsym(RTLD_DEFAULT, "glCullParameterfvEXT"));
-
-    /* GL_EXT_fog_coord */
-    SET_FogCoordPointerEXT(disp, dlsym(RTLD_DEFAULT, "glFogCoordPointerEXT"));
-    SET_FogCoorddEXT(disp, dlsym(RTLD_DEFAULT, "glFogCoorddEXT"));
-    SET_FogCoorddvEXT(disp, dlsym(RTLD_DEFAULT, "glFogCoorddvEXT"));
-    SET_FogCoordfEXT(disp, dlsym(RTLD_DEFAULT, "glFogCoordfEXT"));
-    SET_FogCoordfvEXT(disp, dlsym(RTLD_DEFAULT, "glFogCoordfvEXT"));
-
-    /* GL_EXT_framebuffer_blit */
-    SET_BlitFramebufferEXT(disp, dlsym(RTLD_DEFAULT, "glBlitFramebufferEXT"));
-
-    /* GL_EXT_framebuffer_object */
-    SET_BindFramebufferEXT(disp, dlsym(RTLD_DEFAULT, "glBindFramebufferEXT"));
-    SET_BindRenderbufferEXT(disp, dlsym(RTLD_DEFAULT, "glBindRenderbufferEXT"));
-    SET_CheckFramebufferStatusEXT(disp, dlsym(RTLD_DEFAULT, "glCheckFramebufferStatusEXT"));
-    SET_DeleteFramebuffersEXT(disp, dlsym(RTLD_DEFAULT, "glDeleteFramebuffersEXT"));
-    SET_DeleteRenderbuffersEXT(disp, dlsym(RTLD_DEFAULT, "glDeleteRenderbuffersEXT"));
-    SET_FramebufferRenderbufferEXT(disp, dlsym(RTLD_DEFAULT, "glFramebufferRenderbufferEXT"));
-    SET_FramebufferTexture1DEXT(disp, dlsym(RTLD_DEFAULT, "glFramebufferTexture1DEXT"));
-    SET_FramebufferTexture2DEXT(disp, dlsym(RTLD_DEFAULT, "glFramebufferTexture2DEXT"));
-    SET_FramebufferTexture3DEXT(disp, dlsym(RTLD_DEFAULT, "glFramebufferTexture3DEXT"));
-    SET_GenerateMipmapEXT(disp, dlsym(RTLD_DEFAULT, "glGenerateMipmapEXT"));
-    SET_GenFramebuffersEXT(disp, dlsym(RTLD_DEFAULT, "glGenFramebuffersEXT"));
-    SET_GenRenderbuffersEXT(disp, dlsym(RTLD_DEFAULT, "glGenRenderbuffersEXT"));
-    SET_GetFramebufferAttachmentParameterivEXT(disp, dlsym(RTLD_DEFAULT, "glGetFramebufferAttachmentParameterivEXT"));
-    SET_GetRenderbufferParameterivEXT(disp, dlsym(RTLD_DEFAULT, "glGetRenderbufferParameterivEXT"));
-    SET_IsFramebufferEXT(disp, dlsym(RTLD_DEFAULT, "glIsFramebufferEXT"));
-    SET_IsRenderbufferEXT(disp, dlsym(RTLD_DEFAULT, "glIsRenderbufferEXT"));
-    SET_RenderbufferStorageEXT(disp, dlsym(RTLD_DEFAULT, "glRenderbufferStorageEXT"));
-
-    /* GL_EXT_gpu_program_parameters */
-    SET_ProgramEnvParameters4fvEXT(disp, dlsym(RTLD_DEFAULT, "glProgramEnvParameters4fvEXT"));
-    SET_ProgramLocalParameters4fvEXT(disp, dlsym(RTLD_DEFAULT, "glProgramLocalParameters4fvEXT"));
-
-    /* Pointer Incompatability:
-     * This warning can be safely ignored.  OpenGL.framework adds const to the
-     * two pointers.
-     *
-     * extern void glMultiDrawArraysEXT (GLenum, const GLint *, const GLsizei *, GLsizei);
-     *
-     * void ( * MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount);
-     */
+    (void) dlerror();            /*drain dlerror */
+    handle = dlopen(opengl_framework_path, RTLD_LOCAL);
 
-    /* GL_EXT_multi_draw_arrays */
-    SET_MultiDrawArraysEXT(disp, (void *)dlsym(RTLD_DEFAULT, "glMultiDrawArraysEXT"));
-    SET_MultiDrawElementsEXT(disp, dlsym(RTLD_DEFAULT, "glMultiDrawElementsEXT"));
-
-    /* GL_EXT_point_parameters / GL_ARB_point_parameters */
-    if(dlsym(RTLD_DEFAULT, "glPointParameterfEXT")) {
-        /* GL_EXT_point_parameters */
-        SET_PointParameterfEXT(disp, dlsym(RTLD_DEFAULT, "glPointParameterfEXT"));
-        SET_PointParameterfvEXT(disp, dlsym(RTLD_DEFAULT, "glPointParameterfvEXT"));
-    } else {
-        /* GL_ARB_point_parameters */
-        SET_PointParameterfEXT(disp, dlsym(RTLD_DEFAULT, "glPointParameterfARB"));
-        SET_PointParameterfvEXT(disp, dlsym(RTLD_DEFAULT, "glPointParameterfvARB"));
+    if (!handle) {
+        ErrorF("unable to dlopen %s : %s, using RTLD_DEFAULT\n",
+                opengl_framework_path, dlerror());
+        handle = RTLD_DEFAULT;
     }
 
-    /* GL_EXT_polygon_offset */
-    SET_PolygonOffsetEXT(disp, dlsym(RTLD_DEFAULT, "glPolygonOffsetEXT"));
-
-    /* GL_EXT_secondary_color */
-    SET_SecondaryColor3bEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3bEXT"));
-    SET_SecondaryColor3bvEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3bvEXT"));
-    SET_SecondaryColor3dEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3dEXT"));
-    SET_SecondaryColor3dvEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3dvEXT"));
-    SET_SecondaryColor3fEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3fEXT"));
-    SET_SecondaryColor3fvEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3fvEXT"));
-    SET_SecondaryColor3iEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3iEXT"));
-    SET_SecondaryColor3ivEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3ivEXT"));
-    SET_SecondaryColor3sEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3sEXT"));
-    SET_SecondaryColor3svEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3svEXT"));
-    SET_SecondaryColor3ubEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3ubEXT"));
-    SET_SecondaryColor3ubvEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3ubvEXT"));
-    SET_SecondaryColor3uiEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3uiEXT"));
-    SET_SecondaryColor3uivEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3uivEXT"));
-    SET_SecondaryColor3usEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3usEXT"));
-    SET_SecondaryColor3usvEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3usvEXT"));
-    SET_SecondaryColorPointerEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColorPointerEXT"));
-
-    /* GL_EXT_stencil_two_side */
-    SET_ActiveStencilFaceEXT(disp, dlsym(RTLD_DEFAULT, "glActiveStencilFaceEXT"));
-
-    /* GL_EXT_timer_query */
-    SET_GetQueryObjecti64vEXT(disp, dlsym(RTLD_DEFAULT, "glGetQueryObjecti64vEXT"));
-    SET_GetQueryObjectui64vEXT(disp, dlsym(RTLD_DEFAULT, "glGetQueryObjectui64vEXT"));
-
-    /* GL_EXT_vertex_array */
-    SET_ColorPointerEXT(disp, dlsym(RTLD_DEFAULT, "glColorPointerEXT"));
-    SET_EdgeFlagPointerEXT(disp, dlsym(RTLD_DEFAULT, "glEdgeFlagPointerEXT"));
-    SET_IndexPointerEXT(disp, dlsym(RTLD_DEFAULT, "glIndexPointerEXT"));
-    SET_NormalPointerEXT(disp, dlsym(RTLD_DEFAULT, "glNormalPointerEXT"));
-    SET_TexCoordPointerEXT(disp, dlsym(RTLD_DEFAULT, "glTexCoordPointerEXT"));
-    SET_VertexPointerEXT(disp, dlsym(RTLD_DEFAULT, "glVertexPointerEXT"));
-
-    /* GL_IBM_multimode_draw_arrays */
-    SET_MultiModeDrawArraysIBM(disp, dlsym(RTLD_DEFAULT, "glMultiModeDrawArraysIBM"));
-    SET_MultiModeDrawElementsIBM(disp, dlsym(RTLD_DEFAULT, "glMultiModeDrawElementsIBM"));
-
-    /* GL_MESA_resize_buffers */
-    SET_ResizeBuffersMESA(disp, dlsym(RTLD_DEFAULT, "glResizeBuffersMESA"));
-
-    /* GL_MESA_window_pos */
-    SET_WindowPos4dMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4dMESA"));
-    SET_WindowPos4dvMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4dvMESA"));
-    SET_WindowPos4fMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4fMESA"));
-    SET_WindowPos4fvMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4fvMESA"));
-    SET_WindowPos4iMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4iMESA"));
-    SET_WindowPos4ivMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4ivMESA"));
-    SET_WindowPos4sMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4sMESA"));
-    SET_WindowPos4svMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4svMESA"));
-
-    /* GL_NV_fence */
-    SET_DeleteFencesNV(disp, dlsym(RTLD_DEFAULT, "glDeleteFencesNV"));
-    SET_FinishFenceNV(disp, dlsym(RTLD_DEFAULT, "glFinishFenceNV"));
-    SET_GenFencesNV(disp, dlsym(RTLD_DEFAULT, "glGenFencesNV"));
-    SET_GetFenceivNV(disp, dlsym(RTLD_DEFAULT, "glGetFenceivNV"));
-    SET_IsFenceNV(disp, dlsym(RTLD_DEFAULT, "glIsFenceNV"));
-    SET_SetFenceNV(disp, dlsym(RTLD_DEFAULT, "glSetFenceNV"));
-    SET_TestFenceNV(disp, dlsym(RTLD_DEFAULT, "glTestFenceNV"));
-
-    /* GL_NV_fragment_program */
-    SET_GetProgramNamedParameterdvNV(disp, dlsym(RTLD_DEFAULT, "glGetProgramNamedParameterdvNV"));
-    SET_GetProgramNamedParameterfvNV(disp, dlsym(RTLD_DEFAULT, "glGetProgramNamedParameterfvNV"));
-    SET_ProgramNamedParameter4dNV(disp, dlsym(RTLD_DEFAULT, "glProgramNamedParameter4dNV"));
-    SET_ProgramNamedParameter4dvNV(disp, dlsym(RTLD_DEFAULT, "glProgramNamedParameter4dvNV"));
-    SET_ProgramNamedParameter4fNV(disp, dlsym(RTLD_DEFAULT, "glProgramNamedParameter4fNV"));
-    SET_ProgramNamedParameter4fvNV(disp, dlsym(RTLD_DEFAULT, "glProgramNamedParameter4fvNV"));
-
-    /* GL_NV_geometry_program4 */
-    SET_FramebufferTextureLayerEXT(disp, dlsym(RTLD_DEFAULT, "glFramebufferTextureLayerEXT"));
-
-    /* GL_NV_point_sprite */
-    SET_PointParameteriNV(disp, dlsym(RTLD_DEFAULT, "glPointParameteriNV"));
-    SET_PointParameterivNV(disp, dlsym(RTLD_DEFAULT, "glPointParameterivNV"));
-
-    /* GL_NV_register_combiners */
-    SET_CombinerInputNV(disp, dlsym(RTLD_DEFAULT, "glCombinerInputNV"));
-    SET_CombinerOutputNV(disp, dlsym(RTLD_DEFAULT, "glCombinerOutputNV"));
-    SET_CombinerParameterfNV(disp, dlsym(RTLD_DEFAULT, "glCombinerParameterfNV"));
-    SET_CombinerParameterfvNV(disp, dlsym(RTLD_DEFAULT, "glCombinerParameterfvNV"));
-    SET_CombinerParameteriNV(disp, dlsym(RTLD_DEFAULT, "glCombinerParameteriNV"));
-    SET_CombinerParameterivNV(disp, dlsym(RTLD_DEFAULT, "glCombinerParameterivNV"));
-    SET_FinalCombinerInputNV(disp, dlsym(RTLD_DEFAULT, "glFinalCombinerInputNV"));
-    SET_GetCombinerInputParameterfvNV(disp, dlsym(RTLD_DEFAULT, "glGetCombinerInputParameterfvNV"));
-    SET_GetCombinerInputParameterivNV(disp, dlsym(RTLD_DEFAULT, "glGetCombinerInputParameterivNV"));
-    SET_GetCombinerOutputParameterfvNV(disp, dlsym(RTLD_DEFAULT, "glGetCombinerOutputParameterfvNV"));
-    SET_GetCombinerOutputParameterivNV(disp, dlsym(RTLD_DEFAULT, "glGetCombinerOutputParameterivNV"));
-    SET_GetFinalCombinerInputParameterfvNV(disp, dlsym(RTLD_DEFAULT, "glGetFinalCombinerInputParameterfvNV"));
-    SET_GetFinalCombinerInputParameterivNV(disp, dlsym(RTLD_DEFAULT, "glGetFinalCombinerInputParameterivNV"));
-
-    /* GL_NV_vertex_array_range */
-    SET_FlushVertexArrayRangeNV(disp, dlsym(RTLD_DEFAULT, "glFlushVertexArrayRangeNV"));
-    SET_VertexArrayRangeNV(disp, dlsym(RTLD_DEFAULT, "glVertexArrayRangeNV"));
-
-    /* GL_NV_vertex_program */
-    SET_AreProgramsResidentNV(disp, dlsym(RTLD_DEFAULT, "glAreProgramsResidentNV"));
-    SET_BindProgramNV(disp, dlsym(RTLD_DEFAULT, "glBindProgramNV"));
-    SET_DeleteProgramsNV(disp, dlsym(RTLD_DEFAULT, "glDeleteProgramsNV"));
-    SET_ExecuteProgramNV(disp, dlsym(RTLD_DEFAULT, "glExecuteProgramNV"));
-    SET_GenProgramsNV(disp, dlsym(RTLD_DEFAULT, "glGenProgramsNV"));
-    SET_GetProgramParameterdvNV(disp, dlsym(RTLD_DEFAULT, "glGetProgramParameterdvNV"));
-    SET_GetProgramParameterfvNV(disp, dlsym(RTLD_DEFAULT, "glGetProgramParameterfvNV"));
-    SET_GetProgramStringNV(disp, dlsym(RTLD_DEFAULT, "glGetProgramStringNV"));
-    SET_GetProgramivNV(disp, dlsym(RTLD_DEFAULT, "glGetProgramivNV"));
-    SET_GetTrackMatrixivNV(disp, dlsym(RTLD_DEFAULT, "glGetTrackMatrixivNV"));
-    SET_GetVertexAttribPointervNV(disp, dlsym(RTLD_DEFAULT, "glGetVertexAttribPointervNV"));
-    SET_GetVertexAttribdvNV(disp, dlsym(RTLD_DEFAULT, "glGetVertexAttribdvNV"));
-    SET_GetVertexAttribfvNV(disp, dlsym(RTLD_DEFAULT, "glGetVertexAttribfvNV"));
-    SET_GetVertexAttribivNV(disp, dlsym(RTLD_DEFAULT, "glGetVertexAttribivNV"));
-    SET_IsProgramNV(disp, dlsym(RTLD_DEFAULT, "glIsProgramNV"));
-    SET_LoadProgramNV(disp, dlsym(RTLD_DEFAULT, "glLoadProgramNV"));
-    SET_ProgramParameters4dvNV(disp, dlsym(RTLD_DEFAULT, "glProgramParameters4dvNV"));
-    SET_ProgramParameters4fvNV(disp, dlsym(RTLD_DEFAULT, "glProgramParameters4fvNV"));
-    SET_RequestResidentProgramsNV(disp, dlsym(RTLD_DEFAULT, "glRequestResidentProgramsNV"));
-    SET_TrackMatrixNV(disp, dlsym(RTLD_DEFAULT, "glTrackMatrixNV"));
-    SET_VertexAttrib1dNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1dNV"));
-    SET_VertexAttrib1dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1dvNV"));
-    SET_VertexAttrib1fNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1fNV"));
-    SET_VertexAttrib1fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1fvNV"));
-    SET_VertexAttrib1sNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1sNV"));
-    SET_VertexAttrib1svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1svNV"));
-    SET_VertexAttrib2dNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2dNV"));
-    SET_VertexAttrib2dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2dvNV"));
-    SET_VertexAttrib2fNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2fNV"));
-    SET_VertexAttrib2fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2fvNV"));
-    SET_VertexAttrib2sNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2sNV"));
-    SET_VertexAttrib2svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2svNV"));
-    SET_VertexAttrib3dNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3dNV"));
-    SET_VertexAttrib3dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3dvNV"));
-    SET_VertexAttrib3fNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3fNV"));
-    SET_VertexAttrib3fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3fvNV"));
-    SET_VertexAttrib3sNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3sNV"));
-    SET_VertexAttrib3svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3svNV"));
-    SET_VertexAttrib4dNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4dNV"));
-    SET_VertexAttrib4dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4dvNV"));
-    SET_VertexAttrib4fNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4fNV"));
-    SET_VertexAttrib4fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4fvNV"));
-    SET_VertexAttrib4sNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4sNV"));
-    SET_VertexAttrib4svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4svNV"));
-    SET_VertexAttrib4ubNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4ubNV"));
-    SET_VertexAttrib4ubvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4ubvNV"));
-    SET_VertexAttribPointerNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribPointerNV"));
-    SET_VertexAttribs1dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs1dvNV"));
-    SET_VertexAttribs1fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs1fvNV"));
-    SET_VertexAttribs1svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs1svNV"));
-    SET_VertexAttribs2dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs2dvNV"));
-    SET_VertexAttribs2fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs2fvNV"));
-    SET_VertexAttribs2svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs2svNV"));
-    SET_VertexAttribs3dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs3dvNV"));
-    SET_VertexAttribs3fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs3fvNV"));
-    SET_VertexAttribs3svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs3svNV"));
-    SET_VertexAttribs4dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs4dvNV"));
-    SET_VertexAttribs4fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs4fvNV"));
-    SET_VertexAttribs4svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs4svNV"));
-    SET_VertexAttribs4ubvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs4ubvNV"));
-
-    /* GL_SGIS_multisample */
-    SET_SampleMaskSGIS(disp, dlsym(RTLD_DEFAULT, "glSampleMaskSGIS"));
-    SET_SamplePatternSGIS(disp, dlsym(RTLD_DEFAULT, "glSamplePatternSGIS"));
-
-    /* GL_SGIS_pixel_texture */
-    SET_GetPixelTexGenParameterfvSGIS(disp, dlsym(RTLD_DEFAULT, "glGetPixelTexGenParameterfvSGIS"));
-    SET_GetPixelTexGenParameterivSGIS(disp, dlsym(RTLD_DEFAULT, "glGetPixelTexGenParameterivSGIS"));
-    SET_PixelTexGenParameterfSGIS(disp, dlsym(RTLD_DEFAULT, "glPixelTexGenParameterfSGIS"));
-    SET_PixelTexGenParameterfvSGIS(disp, dlsym(RTLD_DEFAULT, "glPixelTexGenParameterfvSGIS"));
-    SET_PixelTexGenParameteriSGIS(disp, dlsym(RTLD_DEFAULT, "glPixelTexGenParameteriSGIS"));
-    SET_PixelTexGenParameterivSGIS(disp, dlsym(RTLD_DEFAULT, "glPixelTexGenParameterivSGIS"));
-    SET_PixelTexGenSGIX(disp, dlsym(RTLD_DEFAULT, "glPixelTexGenSGIX"));
+    disp = _glapi_create_table_from_handle(handle, "gl");
+    assert(disp);
 
     _glapi_set_dispatch(disp);
 }


More information about the Xquartz-changes mailing list