Commit 3fead00f authored by Jan Möbius's avatar Jan Möbius

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 21d57ac0
......@@ -47,8 +47,6 @@
* *
\*===========================================================================*/
#include <ACG/GL/acg_glew.hh>
#include "PostProcessorAnaglyphPlugin.hh"
#include <iostream>
......@@ -60,6 +58,14 @@
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#if QT_VERSION >= 0x050000
#include <QOpenGLContext>
#include <QSurfaceFormat>
#else
#include <QGLFormat>
#endif
PostProcessorAnaglyphPlugin::PostProcessorAnaglyphPlugin()
{
}
......@@ -69,10 +75,41 @@ PostProcessorAnaglyphPlugin::~PostProcessorAnaglyphPlugin()
}
QString PostProcessorAnaglyphPlugin::checkOpenGL() {
if ( ! ACG::openGLVersion(3, 0) )
#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