From 96d99ac4f86e711cef77eb08bfd82c1e144fb976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 25 May 2015 20:11:10 +0200 Subject: [PATCH] Remove unused Context::{major,minor}Version() functions. Superseeded by Context::version() and various utilities around Version enum. --- src/Magnum/Context.cpp | 26 ++++++++++++++------------ src/Magnum/Context.h | 18 ------------------ 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/src/Magnum/Context.cpp b/src/Magnum/Context.cpp index 9c7d5085b..dad746385 100644 --- a/src/Magnum/Context.cpp +++ b/src/Magnum/Context.cpp @@ -360,13 +360,15 @@ Context::Context(void functionLoader()) { /* Load GL function pointers */ if(functionLoader) functionLoader(); + GLint majorVersion, minorVersion; + /* Get version on ES 3.0+/WebGL 2.0+ */ #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2) /* ES 3.0+ */ #ifndef MAGNUM_TARGET_WEBGL - glGetIntegerv(GL_MAJOR_VERSION, &_majorVersion); - glGetIntegerv(GL_MINOR_VERSION, &_minorVersion); + glGetIntegerv(GL_MAJOR_VERSION, &majorVersion); + glGetIntegerv(GL_MINOR_VERSION, &minorVersion); /* WebGL 2.0, treat it as ES 3.0 */ #else @@ -375,8 +377,8 @@ Context::Context(void functionLoader()) { Error() << "Context: unsupported version string:" << version; std::exit(65); } - _majorVersion = 3; - _minorVersion = 0; + majorVersion = 3; + minorVersion = 0; #endif /* On GL 2.1 and ES 2.0 there is no GL_{MAJOR,MINOR}_VERSION, we have to @@ -385,10 +387,10 @@ Context::Context(void functionLoader()) { enum error. */ #else #ifndef MAGNUM_TARGET_GLES2 - glGetIntegerv(GL_MAJOR_VERSION, &_majorVersion); + glGetIntegerv(GL_MAJOR_VERSION, &majorVersion); const auto versionNumberError = Renderer::error(); if(versionNumberError == Renderer::Error::NoError) - glGetIntegerv(GL_MINOR_VERSION, &_minorVersion); + glGetIntegerv(GL_MINOR_VERSION, &minorVersion); else #endif { @@ -408,11 +410,11 @@ Context::Context(void functionLoader()) { version.find("OpenGL ES 3.") != std::string::npos) #endif { - _majorVersion = 2; + majorVersion = 2; #ifndef MAGNUM_TARGET_GLES - _minorVersion = 1; + minorVersion = 1; #else - _minorVersion = 0; + minorVersion = 0; #endif } else { Error() << "Context: unsupported version string:" << version; @@ -422,7 +424,7 @@ Context::Context(void functionLoader()) { #endif /* Compose the version enum */ - _version = Magnum::version(_majorVersion, _minorVersion); + _version = Magnum::version(majorVersion, minorVersion); /* Check that version retrieval went right */ #ifndef CORRADE_NO_ASSERT @@ -441,9 +443,9 @@ Context::Context(void functionLoader()) { #endif { #ifndef MAGNUM_TARGET_GLES - Error() << "Context: unsupported OpenGL version" << Magnum::version(_version); + Error() << "Context: unsupported OpenGL version" << std::make_pair(majorVersion, minorVersion); #else - Error() << "Context: unsupported OpenGL ES version" << Magnum::version(_version); + Error() << "Context: unsupported OpenGL ES version" << std::make_pair(majorVersion, minorVersion); #endif std::exit(66); } diff --git a/src/Magnum/Context.h b/src/Magnum/Context.h index 424e1e2d1..6caf35694 100644 --- a/src/Magnum/Context.h +++ b/src/Magnum/Context.h @@ -240,22 +240,6 @@ class MAGNUM_EXPORT Context { */ Version version() const { return _version; } - /** - * @brief Major OpenGL version (e.g. `4`) - * - * @see @ref minorVersion(), @ref version(), @ref versionString(), - * @ref shadingLanguageVersionString() - */ - Int majorVersion() const { return _majorVersion; } - - /** - * @brief Minor OpenGL version (e.g. `3`) - * - * @see @ref majorVersion(), @ref version(), @ref versionString(), - * @ref shadingLanguageVersionString() - */ - Int minorVersion() const { return _minorVersion; } - /** * @brief Vendor string * @@ -490,8 +474,6 @@ class MAGNUM_EXPORT Context { MAGNUM_LOCAL void setupDriverWorkarounds(); Version _version; - Int _majorVersion; - Int _minorVersion; #ifndef MAGNUM_TARGET_WEBGL Flags _flags; #endif