+ if(get_gl_api()==OPENGL && get_gl_version()>=Version(3, 0))
+ {
+ typedef GLubyte *(APIENTRY *FPtr_glGetStringi)(GLenum, GLuint);
+ FPtr_glGetStringi glGetStringi = reinterpret_cast<FPtr_glGetStringi>(get_proc_address("glGetStringi"));
+ int n_extensions;
+ glGetIntegerv(GL_NUM_EXTENSIONS, &n_extensions);
+ for(int i=0; i<n_extensions; ++i)
+ extensions.insert(reinterpret_cast<const char *>(glGetStringi(GL_EXTENSIONS, i)));
+ }
+ else
+ {
+ if(const char *gl_ext = reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)))
+ {
+ vector<string> exts = split(gl_ext);
+ extensions.insert(exts.begin(), exts.end());
+ }
+ }
+
+ if(const char *renderer_ptr = reinterpret_cast<const char *>(glGetString(GL_RENDERER)))
+ {
+ string renderer = renderer_ptr;
+ if(renderer.find("Radeon")!=string::npos || renderer.find("AMD")!=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");
+
+ /* AMD's uniform buffer objects only work with the core version of
+ shaders. */
+ if(!(get_gl_version()>=Version(2, 0)))
+ extensions.erase("GL_ARB_uniform_buffer_object");
+ }
+ }
+
+ if(const char *disable_ptr = getenv("MSPGL_DISABLE_EXTENSIONS"))