From e0d27358fb9d62fcba96e1d14fa3185ce63668e9 Mon Sep 17 00:00:00 2001 From: binary1248 Date: Sat, 18 Apr 2015 21:27:53 +0200 Subject: [PATCH] Added OpenGL vendor and renderer string checks to warn if the application is being run using a non-accelerated OpenGL context. --- src/SFML/Window/GlContext.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/SFML/Window/GlContext.cpp b/src/SFML/Window/GlContext.cpp index a1862fa3..1a667740 100644 --- a/src/SFML/Window/GlContext.cpp +++ b/src/SFML/Window/GlContext.cpp @@ -473,6 +473,19 @@ void GlContext::checkSettings(const ContextSettings& requestedSettings) { // Perform checks to inform the user if they are getting a context they might not have expected + // Detect any known non-accelerated implementations and warn + const char* vendorName = reinterpret_cast(glGetString(GL_VENDOR)); + const char* rendererName = reinterpret_cast(glGetString(GL_RENDERER)); + + if (vendorName && rendererName) + { + if ((std::strcmp(vendorName, "Microsoft Corporation") == 0) && (std::strcmp(rendererName, "GDI Generic") == 0)) + { + err() << "Warning: Detected \"Microsoft Corporation GDI Generic\" OpenGL implementation" << std::endl + << "The current OpenGL implementation is not hardware-accelerated" << std::endl; + } + } + int version = m_settings.majorVersion * 10 + m_settings.minorVersion; int requestedVersion = requestedSettings.majorVersion * 10 + requestedSettings.minorVersion;