X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fextension.cpp;h=a55da9bac1c7b30ab965b6ce70e20390eafda6d1;hp=8618cc3eeef599e7c7a1dc36fe2ef724f234e91f;hb=e6077f9f25b794c174e1017c2c0763e77a6fddda;hpb=8e553af57b712051f47293c971671f4f6a939be2 diff --git a/source/core/extension.cpp b/source/core/extension.cpp index 8618cc3e..a55da9ba 100644 --- a/source/core/extension.cpp +++ b/source/core/extension.cpp @@ -28,31 +28,6 @@ using namespace std; namespace Msp { namespace GL { -Version::Version() -{ - major = 0; - minor = 0; -} - -Version::Version(unsigned short a, unsigned short i) -{ - major = a; - minor = i; -} - -Version::Version(const string &s) -{ - vector parts = split(s, '.'); - major = lexical_cast(parts[0]); - minor = lexical_cast(parts[1]); -} - -bool Version::operator>=(const Version &other) const -{ - return major>other.major || (major==other.major && minor>=other.minor); -} - - Extension::Extension(const char *n, InitFunc f): name(n), init_func(f), @@ -89,7 +64,7 @@ bool is_supported(const string &ext) if(!init_done) { - if(get_gl_api()==OPENGL && get_gl_version()>=Version(3, 0)) + if(get_backend_api()==OPENGL && get_backend_version()>=Version(3, 0)) { typedef GLubyte *(APIENTRY *FPtr_glGetStringi)(GLenum, GLuint); FPtr_glGetStringi glGetStringi = reinterpret_cast(get_proc_address("glGetStringi")); @@ -115,7 +90,7 @@ bool is_supported(const string &ext) bool is_supported(const Version &core_version, const Version &deprecated_version) { - const Version &version = get_gl_version(); + const Version &version = get_backend_version(); if(deprecated_version && version>=deprecated_version && get_gl_profile()==CORE_PROFILE) return false; return (version>=core_version); @@ -144,7 +119,7 @@ bool is_disabled(const string &ext) /* AMD's uniform buffer objects only work with the core version of shaders. */ - if(get_gl_version()=Version(3, 0)) + if(get_backend_api()==OPENGL && get_backend_version()>=Version(3, 0)) { int mask; glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask); @@ -183,34 +149,6 @@ GLProfile get_gl_profile() return profile; } -inline Version _get_gl_version() -{ - const char *gl_ver_ptr = reinterpret_cast(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(glGetString(GL_SHADING_LANGUAGE_VERSION));