3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
13 #include <msp/strings/utils.h>
14 #include "arb_shader_objects.h"
15 #include "arb_vertex_shader.h"
17 #include "extension.h"
24 bool is_supported(const string &ext)
26 static set<string> extensions;
27 static bool init_done=false;
31 if(const char *gl_ext=reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)))
33 vector<string> exts=split(gl_ext);
34 extensions.insert(exts.begin(), exts.end());
37 /* XXX Conceptually a bit weird place for this, but I couldn't really come up
38 with anything better that would still be transparent. */
39 if(extensions.count("GL_ARB_shader_objects"))
40 init_arb_shader_objects();
41 if(extensions.count("GL_ARB_vertex_shader"))
42 init_arb_vertex_shader();
47 return extensions.count(ext);
50 void require_extension(const string &ext)
52 if(!is_supported(ext))
53 throw UnsupportedExtension(ext+" is not supported");
56 ExtFunc *get_proc_address(const string &name)
59 return glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(name.c_str()));