Commit 261cbe3a authored by Christopher Tenter's avatar Christopher Tenter
Browse files

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 3abe9b75
......@@ -58,13 +58,6 @@
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#if QT_VERSION >= 0x050000
#include <QOpenGLContext>
#include <QSurfaceFormat>
#else
#include <QGLFormat>
#endif
PostProcessorAnaglyphPlugin::PostProcessorAnaglyphPlugin()
{
......@@ -75,41 +68,10 @@ PostProcessorAnaglyphPlugin::~PostProcessorAnaglyphPlugin()
}
QString PostProcessorAnaglyphPlugin::checkOpenGL() {
#if QT_VERSION < 0x050000
QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
if ( ! flags.testFlag(QGLFormat::OpenGL_Version_3_0) )
if (!ACG::openGLVersion(3, 0))
return QString("Insufficient OpenGL Version! OpenGL 3.0 or higher required");
// 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
return QString("");
}
......
......@@ -75,6 +75,15 @@ QString PostProcessorDepthImagePlugin::postProcessorName() {
return QString("Show Depth Image");
}
QString PostProcessorDepthImagePlugin::checkOpenGL()
{
if ( ! ACG::openGLVersion(3, 0) )
return QString("Insufficient OpenGL Version! OpenGL 3.0 or higher required");
return QString("");
}
void PostProcessorDepthImagePlugin::postProcess(ACG::GLState* _glstate, const std::vector<const PostProcessorInput*>& _input, const PostProcessorOutput& _output) {
// ======================================================================================================
......
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 18127 $ *
* $LastChangedBy: moebius $ *
* $Date: 2014-02-05 10:12:54 +0100 (Wed, 05 Feb 2014) $ *
* *
\*===========================================================================*/
/** @file
*
* Contains definitions of the PostProcessorDepthImagePlugin that require qt headers
* which are incompatible with glew.h.
*/
#include "PostProcessorDepthImagePlugin.hh"
#if QT_VERSION >= 0x050000
#include <QOpenGLContext>
#include <QSurfaceFormat>
#else
#include <QGLFormat>
#endif
QString PostProcessorDepthImagePlugin::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");
// 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
}
......@@ -74,6 +74,13 @@ QString PostProcessorGrayscalePlugin::postProcessorName() {
return QString("Grayscale");
}
QString PostProcessorGrayscalePlugin::checkOpenGL() {
if (!ACG::openGLVersion(3, 0))
return QString("Insufficient OpenGL Version! OpenGL 3.0 or higher required");
return QString("");
}
void PostProcessorGrayscalePlugin::postProcess(ACG::GLState* _glstate, const std::vector<const PostProcessorInput*>& _input, const PostProcessorOutput& _output) {
......
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 18127 $ *
* $LastChangedBy: moebius $ *
* $Date: 2014-02-05 10:12:54 +0100 (Wed, 05 Feb 2014) $ *
* *
\*===========================================================================*/
/** @file
*
* Contains definitions of the PostProcessorGrayPlugin that require qt headers
* which are incompatible with glew.h.
*/
#include "PostProcessorGrayPlugin.hh"
#if QT_VERSION >= 0x050000
#include <QOpenGLContext>
#include <QSurfaceFormat>
#else
#include <QGLFormat>
#endif
QString PostProcessorGrayscalePlugin::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");
// 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
}
......@@ -78,6 +78,20 @@ QAction* PostProcessorPhilipsStereoPlugin::optionsAction() {
return action;
}
QString PostProcessorPhilipsStereoPlugin::checkOpenGL() {
if ( ! ACG::openGLVersion(3, 0) )
return QString("Insufficient OpenGL Version! OpenGL 3.0 or higher required");
// Check extensions
QString missing("");
if ( !ACG::checkExtensionSupported("GL_ARB_texture_rectangle") )
missing += "GL_ARB_texture_rectangle extension missing\n";
return missing;
}
//-----------------------------------------------------------------------------
void PostProcessorPhilipsStereoPlugin::postProcess(ACG::GLState* _glstate, const std::vector<const PostProcessorInput*>& _input, const PostProcessorOutput& _output) {
......
......@@ -64,55 +64,6 @@
#else
#include <QGLFormat>
#endif
QString PostProcessorPhilipsStereoPlugin::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");
// Check extensions
QString glExtensions = QString((const char*)glGetString(GL_EXTENSIONS));
QString missing("");
if ( !glExtensions.contains("GL_ARB_texture_rectangle") )
missing += "GL_ARB_texture_rectangle extension missing\n";
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("");
if ( !context->hasExtension("GL_ARB_texture_rectangle") )
missing += "GL_ARB_vertex_buffer_object extension missing\n";
return missing;
} else {
return name() + QString(": No context available");
}
#endif
}
void PostProcessorPhilipsStereoPlugin::slotShowOptionsMenu() {
// Create widget if it does not exist
......
......@@ -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");
......
......@@ -54,13 +54,6 @@
#include <ACG/GL/ShaderCache.hh>
#if QT_VERSION >= 0x050000
#include <QOpenGLContext>
#include <QSurfaceFormat>
#else
#include <QGLFormat>
#endif
// =================================================
......@@ -131,58 +124,19 @@ void NormalRenderer::render(ACG::GLState* _glState, Viewer::ViewerProperties& _p
QString NormalRenderer::checkOpenGL()
{
#if QT_VERSION < 0x050000
// Get version and check
QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
if ( !flags.testFlag(QGLFormat::OpenGL_Version_3_2) )
if (!ACG::openGLVersion(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") )
if ( !ACG::checkExtensionSupported("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
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
return missing;
} else {
return name() + QString(": No context available");
}
#ifndef __APPLE__
if ( !ACG::checkExtensionSupported("GL_ARB_vertex_program") )
missing += "GL_ARB_vertex_program extension missing\n";
#endif
return missing;
}
#if QT_VERSION < 0x050000
......
......@@ -54,13 +54,6 @@
#include <ACG/GL/GLError.hh>
#if QT_VERSION >= 0x050000
#include <QOpenGLContext>
#include <QSurfaceFormat>
#else
#include <QGLFormat>
#endif
// this define enables a shader export of the generated peel shader for debugging purpose
//#define DEPTHPEELING_SHADER_EXPORT
......@@ -1098,57 +1091,20 @@ unsigned int DepthPeelingPlugin::getPeelShaderIndex(ACG::SceneGraph::DrawModes::
}
QString DepthPeelingPlugin::checkOpenGL() {
#if QT_VERSION < 0x050000