]> git.tdb.fi Git - libs/gl.git/blobdiff - source/extension.cpp
Final touches of OS X support
[libs/gl.git] / source / extension.cpp
index 6ca4f08ce61728da8a1a9c994880be0d85810a97..56f96d4ecee2136dcde2d42f5fbdfa7bbf8b421b 100644 (file)
@@ -1,5 +1,5 @@
 #include <set>
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
 #define GLX_GLXEXT_PROTOTYPES
 #include <GL/glx.h>
 #endif
@@ -53,6 +53,13 @@ bool is_supported(const string &ext)
                        extensions.insert(exts.begin(), exts.end());
                }
 
+               string renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
+               if(renderer.find("Radeon")!=string::npos)
+                       /* Radeon doesn't process NV_primitive_restart correctly and treats
+                       the restart index as a normal element if the indices are stored in a
+                       buffer. */
+                       extensions.erase("GL_NV_primitive_restart");
+
                init_done = true;
        }
 
@@ -85,10 +92,13 @@ bool is_version_at_least(unsigned a, unsigned b)
 
 ExtFunc *get_proc_address(const string &name)
 {
-#ifndef WIN32
-       return glXGetProcAddressARB(reinterpret_cast<const unsigned char *>(name.c_str()));
-#else
+#if defined(WIN32)
        return reinterpret_cast<ExtFunc *>(wglGetProcAddress(name.c_str()));
+#elif defined(__APPLE__)
+       (void)name;
+       return 0;  // Not supported
+#else
+       return glXGetProcAddressARB(reinterpret_cast<const unsigned char *>(name.c_str()));
 #endif
 }