From: Mikko Rasa Date: Thu, 15 Jul 2010 11:27:29 +0000 (+0000) Subject: Add is_version_at_least function X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6a4907898281b738111e0c6527cc46f8810dc123;p=libs%2Fgl.git Add is_version_at_least function Reorder functions in extension.* more logically --- diff --git a/source/extension.cpp b/source/extension.cpp index 9ed17779..bab160d5 100644 --- a/source/extension.cpp +++ b/source/extension.cpp @@ -60,6 +60,12 @@ bool is_supported(const string &ext) return extensions.count(ext); } +void require_extension(const string &ext) +{ + if(!is_supported(ext)) + throw UnsupportedExtension(ext); +} + const Version &get_gl_version() { static Version version; @@ -84,16 +90,15 @@ const Version &get_gl_version() return version; } -void require_extension(const string &ext) +bool is_version_at_least(unsigned a, unsigned b) { - if(!is_supported(ext)) - throw UnsupportedExtension(ext); + const Version &ver = get_gl_version(); + return (ver.major>a || (ver.major==a && ver.minor>=b)); } void require_version(unsigned a, unsigned b) { - const Version &ver = get_gl_version(); - if(ver.major