Commit ab6544e5 authored by Jan Möbius's avatar Jan Möbius
Browse files

Implement Qt5 style to detect current OpenGL Context capability

Don't use classical rendering plugin if no compatibility context is available


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@21124 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 1316db6c
......@@ -55,12 +55,48 @@
#include "PostProcessorSobelPlugin.hh"
#include <QGLFormat>
#if QT_VERSION >= 0x050000
#include <QOpenGLContext>
#include <QSurfaceFormat>
#else
#include <QGLFormat>
#endif
QString PostProcessorSobelPlugin::checkOpenGL() {
#if QT_VERSION < 0x050000
QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
if ( ! flags.testFlag(QGLFormat::OpenGL_Version_3_0) )
return QString("Insufficient OpenGL Version! OpenGL 3.0 or higher required");
return QString("");
// Check extensions
QString glExtensions = QString((const char*)glGetString(GL_EXTENSIONS));
QString missing("");
return missing;
#else
QOpenGLContext* context = QOpenGLContext::currentContext();
if ( context ) {
// Get version and check
QSurfaceFormat format = context->format();
if ( (format.majorVersion() < 3) ) {
return QString("Insufficient OpenGL Version! OpenGL 3.0 or higher required");
}
// Check extensions
QString missing("");
return missing;
} else {
return name() + QString(": No context available");
}
#endif
}
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