Commit 166c21e4 authored by Ellen Dekkers's avatar Ellen Dekkers

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
parent 6b97a0bf
...@@ -1414,17 +1414,31 @@ bool Core::checkOpenGLCapabilities() { ...@@ -1414,17 +1414,31 @@ bool Core::checkOpenGLCapabilities() {
// Status ok? // Status ok?
bool ok = true; bool ok = true;
bool warn = false;
QString missing; QString missing;
// We need at least version 2.0 or higher // We need at least version 2.0 or higher
QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags(); QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
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) | if ( !( flags.testFlag(QGLFormat::OpenGL_Version_3_0) |
flags.testFlag(QGLFormat::OpenGL_Version_2_1) | flags.testFlag(QGLFormat::OpenGL_Version_2_1) |
flags.testFlag(QGLFormat::OpenGL_Version_2_0) ) ) { flags.testFlag(QGLFormat::OpenGL_Version_2_0) ) ) {
ok = false; ok = false;
missing += tr("OpenGL Version less then 2.0!\n"); missing += tr("OpenGL Version less then 2.0!\n");
} }
}
} else {
ok = false;
missing += tr("No OpenGL support found!\n");
}
//Get OpenGL extensions //Get OpenGL extensions
QString glExtensions = QString((const char*)glGetString(GL_EXTENSIONS)); QString glExtensions = QString((const char*)glGetString(GL_EXTENSIONS));
...@@ -1451,6 +1465,15 @@ bool Core::checkOpenGLCapabilities() { ...@@ -1451,6 +1465,15 @@ bool Core::checkOpenGLCapabilities() {
// Unsafe operation, so quit the application // Unsafe operation, so quit the application
exit(1); 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 #ifndef NDEBUG
else { else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment