From: Mikko Rasa Date: Mon, 25 Nov 2013 15:22:12 +0000 (+0200) Subject: Add function to check GLSL version X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=f92c10f969a02e707a236cb364332bf079cdf4fc;p=libs%2Fgl.git Add function to check GLSL version --- diff --git a/source/extension.cpp b/source/extension.cpp index 41b06b21..d0361665 100644 --- a/source/extension.cpp +++ b/source/extension.cpp @@ -103,6 +103,18 @@ const Version &get_gl_version() return version; } +inline Version _get_glsl_version() +{ + string glsl_ver = reinterpret_cast(glGetString(GL_SHADING_LANGUAGE_VERSION)); + return Version(glsl_ver.substr(0, glsl_ver.find(' '))); +} + +const Version &get_glsl_version() +{ + static Version version = _get_glsl_version(); + return version; +} + bool is_version_at_least(unsigned a, unsigned b) { return get_gl_version()>=Version(a, b); diff --git a/source/extension.h b/source/extension.h index df6bd78d..e0fe3eff 100644 --- a/source/extension.h +++ b/source/extension.h @@ -59,6 +59,9 @@ bool is_supported(const std::string &); /** Returns the OpenGL version number, as reported by the implementation. */ const Version &get_gl_version(); +/** Returns the GLSL version number, as reported by the implementation. */ +const Version &get_glsl_version(); + /** Indicates whether the OpenGL version is at least a.b. */ bool is_version_at_least(unsigned a, unsigned b);