From 166c21e41c649c0c236df955800f82d3b9fb60d2 Mon Sep 17 00:00:00 2001 From: Ellen Dekkers Date: Fri, 2 Jul 2010 11:17:29 +0000 Subject: [PATCH] Updated Check for OpenGL capabilities and added warnings git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9767 383ad7c9-94d9-4d36-a494-682f7c89f535 --- Core/Core.cc | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/Core/Core.cc b/Core/Core.cc index bdd6bbc2..306ca7dc 100644 --- a/Core/Core.cc +++ b/Core/Core.cc @@ -1413,17 +1413,31 @@ void Core::slotDeleteAllObjects( ){ bool Core::checkOpenGLCapabilities() { // Status ok? - bool ok = true; + bool ok = true; + bool warn = false; QString missing; // We need at least version 2.0 or higher QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags(); - if ( !( flags.testFlag(QGLFormat::OpenGL_Version_3_0) | - flags.testFlag(QGLFormat::OpenGL_Version_2_1) | - flags.testFlag(QGLFormat::OpenGL_Version_2_0) ) ) { - ok = false; - missing += tr("OpenGL Version less then 2.0!\n"); + + if ( QGLFormat::hasOpenGL() ) { + if ( flags.testFlag(QGLFormat::OpenGL_Version_None) ) { + missing += tr("OpenGL Version Unknown to QT!\n"); + missing += tr("OpenGL reports version: ") + QString((const char*)glGetString( GL_VERSION )) ; + warn = true; + } else { + if ( !( flags.testFlag(QGLFormat::OpenGL_Version_3_0) | + flags.testFlag(QGLFormat::OpenGL_Version_2_1) | + flags.testFlag(QGLFormat::OpenGL_Version_2_0) ) ) { + ok = false; + missing += tr("OpenGL Version less then 2.0!\n"); + } + } + + } else { + ok = false; + missing += tr("No OpenGL support found!\n"); } //Get OpenGL extensions @@ -1451,7 +1465,16 @@ bool Core::checkOpenGLCapabilities() { // Unsafe operation, so quit the application exit(1); - } + } else if ( warn ) { + QString message = tr("Warning! The OpenGL capabilities of your current machine/driver could be insufficient!\n\n"); + message += tr("The following checks failed:\n\n"); + message += missing; + + std::cerr << message.toStdString() << std::endl; + + QMessageBox::warning ( 0, tr( "Insufficient OpenGL Capabilities!"),message ); + + } #ifndef NDEBUG else { std::cerr << "OpenGL Version Check succeeded" << std::endl; -- GitLab