From 17ae24cee23e007dbc63d2d2e22bd1121af37181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 24 Jan 2014 00:26:43 +0100 Subject: [PATCH] It probably isn't good idea to have version checks as assertions. In particular when building with CORRADE_NO_ASSERT the version doesn't get checked at all, silently failing on null pointer somewhere else. --- src/Magnum/Context.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Magnum/Context.cpp b/src/Magnum/Context.cpp index c9b198999..6fedbee74 100644 --- a/src/Magnum/Context.cpp +++ b/src/Magnum/Context.cpp @@ -312,12 +312,20 @@ Context::Context() { #endif #ifndef MAGNUM_TARGET_GLES - CORRADE_ASSERT(isVersionSupported(Version::GL210), "Context: unsupported OpenGL version" << Int(_version), ); + if(!isVersionSupported(Version::GL210)) #elif defined(MAGNUM_TARGET_GLES2) - CORRADE_ASSERT(isVersionSupported(Version::GLES200), "Context: unsupported OpenGL ES version" << Int(_version), ); + if(!isVersionSupported(Version::GLES200)) #else - CORRADE_ASSERT(isVersionSupported(Version::GLES300), "Context: unsupported OpenGL ES version" << Int(_version), ); + if(!isVersionSupported(Version::GLES300)) #endif + { + #ifndef MAGNUM_TARGET_GLES + Error() << "Context: unsupported OpenGL version" << Int(_version); + #else + Error() << "Context: unsupported OpenGL ES version" << Int(_version); + #endif + std::exit(1); + } /* Context flags are supported since GL 3.0 */ #ifndef MAGNUM_TARGET_GLES