]> git.tdb.fi Git - libs/gl.git/blobdiff - source/extension.cpp
Add a less-than operator to Version
[libs/gl.git] / source / extension.cpp
index 2183a965027d85550447fc77589f419789db890d..fda183d22f374ea309851019fbcc4f271d8d430a 100644 (file)
@@ -105,7 +105,7 @@ bool is_supported(const string &ext)
 
                                /* AMD's uniform buffer objects only work with the core version of
                                shaders. */
-                               if(!(get_gl_version()>=Version(2, 0)))
+                               if(get_gl_version()<Version(2, 0))
                                        extensions.erase("GL_ARB_uniform_buffer_object");
                        }
                }
@@ -132,6 +132,25 @@ GLApi get_gl_api()
 #endif
 }
 
+inline GLProfile _get_gl_profile()
+{
+       if(get_gl_api()==OPENGL && get_gl_version()>=Version(3, 0))
+       {
+               int mask;
+               glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
+               if(mask==GL_CONTEXT_CORE_PROFILE_BIT)
+                       return CORE_PROFILE;
+       }
+
+       return COMPATIBILITY_PROFILE;
+}
+
+GLProfile get_gl_profile()
+{
+       static GLProfile profile = _get_gl_profile();
+       return profile;
+}
+
 inline Version _get_gl_version()
 {
        const char *gl_ver_ptr = reinterpret_cast<const char *>(glGetString(GL_VERSION));