Commit 4ad58ea2 authored by Christopher Tenter's avatar Christopher Tenter

replace qt opengl checks with ACG refs #2529

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@21133 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f4405707
......@@ -214,6 +214,29 @@ DepthPeeling::~DepthPeeling()
}
QString DepthPeeling::checkOpenGL()
{
if (!ACG::openGLVersion(3, 2))
return QString("Insufficient OpenGL Version! OpenGL 3.2 or higher required");
QString missing("");
if (!ACG::checkExtensionSupported("GL_ARB_vertex_buffer_object"))
missing += "GL_ARB_vertex_buffer_object extension missing\n";
#ifndef __APPLE__
if (!ACG::checkExtensionSupported("GL_ARB_vertex_program"))
missing += "GL_ARB_vertex_program extension missing\n";
#endif
if (!ACG::checkExtensionSupported("GL_ARB_occlusion_query"))
missing += "GL_ARB_occlusion_query extension missing\n";
return missing;
}
void DepthPeeling::initializePlugin()
{
ACG::ShaderProgGenerator::setShaderDir(OpenFlipper::Options::shaderDirStr());
......
......@@ -58,73 +58,6 @@
#include <QAction>
#include <QMenu>
#if QT_VERSION >= 0x050000
#include <QOpenGLContext>
#include <QSurfaceFormat>
#else
#include <QGLFormat>
#endif
QString DepthPeeling::checkOpenGL()
{
#if QT_VERSION < 0x050000
// Get version and check
QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
if ( !flags.testFlag(QGLFormat::OpenGL_Version_3_2) )
return QString("Insufficient OpenGL Version! OpenGL 3.2 or higher required");
// Check extensions
QString glExtensions = QString((const char*)glGetString(GL_EXTENSIONS));
QString missing("");
if ( !glExtensions.contains("GL_ARB_vertex_buffer_object") )
missing += "GL_ARB_vertex_buffer_object extension missing\n";
#ifndef __APPLE__
if ( !glExtensions.contains("GL_ARB_vertex_program") )
missing += "GL_ARB_vertex_program extension missing\n";
#endif
if ( !glExtensions.contains("GL_ARB_occlusion_query") )
missing += "GL_ARB_occlusion_query extension missing\n";
return missing;
#else
QOpenGLContext* context = QOpenGLContext::currentContext();
if ( context ) {
// Get version and check
QSurfaceFormat format = context->format();
if ( (format.majorVersion() < 4) && (format.minorVersion() < 2) ) {
return QString("Insufficient OpenGL Version! OpenGL 3.2 or higher required");
}
// Check extensions
QString missing("");
if ( !context->hasExtension("GL_ARB_vertex_buffer_object") )
missing += "GL_ARB_vertex_buffer_object extension missing\n";
#ifndef __APPLE__
if ( !context->hasExtension("GL_ARB_vertex_program") )
missing += "GL_ARB_vertex_program extension missing\n";
#endif
if ( !context->hasExtension("GL_ARB_occlusion_query") )
missing += "GL_ARB_occlusion_query extension missing\n";
return missing;
} else {
return name() + QString(": No context available");
}
#endif
}
QAction* DepthPeeling::optionsAction()
{
QMenu* menu = new QMenu("Depth Peeling Mode");
......
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