-
-GraphicsApi get_backend_api()
-{
-#ifdef GL_ES_VERSION_2_0
- return OPENGL_ES;
-#else
- return OPENGL;
-#endif
-}
-
-inline Version get_gl_version()
-{
- const char *gl_ver_ptr = reinterpret_cast<const char *>(glGetString(GL_VERSION));
- if(!gl_ver_ptr)
- throw runtime_error("OpenGL version not available");
-
- string gl_ver = gl_ver_ptr;
- if(!gl_ver.compare(0, 10, "OpenGL ES "))
- gl_ver.erase(0, 10);
-
- Version ver(gl_ver.substr(0, gl_ver.find(' ')));
-
- if(const char *force_ver_ptr = getenv("MSPGL_FORCE_VERSION"))
- {
- Version force_ver(force_ver_ptr);
- if(force_ver<ver)
- ver = force_ver;
- }
-
- return ver;
-}
-
-const Version &get_backend_version()
-{
- static Version version = get_gl_version();
- return version;
-}
-