+const Version &get_gl_version()
+{
+ static Version version;
+ static bool init_done = false;
+
+ if(!init_done)
+ {
+ string gl_ver = reinterpret_cast<const char *>(glGetString(GL_VERSION));
+ vector<string> parts = split(gl_ver.substr(0, gl_ver.find(' ')), '.');
+ version.major = lexical_cast<unsigned>(parts[0]);
+ version.minor = lexical_cast<unsigned>(parts[1]);
+
+ unsigned combined = version.major*0x100+version.minor;
+ if(combined>=0x102)
+ init_version_1_2();
+ if(combined>=0x103)
+ init_version_1_3();
+
+ init_done = true;
+ }
+
+ return version;
+}
+