Commit abe040e2 authored by Jan Möbius's avatar Jan Möbius

Require QT5.5 as minimal version. All other checks for versions lower than 5.5 removed

parent bf5adef2
......@@ -527,19 +527,16 @@ int main(int argc, char **argv)
if ( !OpenFlipper::Options::nogui() ) {
// OpenGL check
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
#endif
QApplication::setColorSpec( QApplication::CustomColor );
#if QT_VERSION >= 0x050500
QSurfaceFormat format;
QSurfaceFormat format;
QPair<int,int> version = OpenFlipper::Options::glVersion();
format.setVersion(version.first, version.second);
if (OpenFlipper::Options::coreProfile())
{
{
format.setProfile(QSurfaceFormat::CoreProfile);
}
else {
......@@ -555,7 +552,7 @@ int main(int argc, char **argv)
QSurfaceFormat::setDefaultFormat(format);
QApplication app(argc, argv);
QApplication app(argc, argv);
QScreen *screen = app.primaryScreen();
QOffscreenSurface *surface = new QOffscreenSurface();
......@@ -564,7 +561,6 @@ int main(int argc, char **argv)
//make the globally shared OpenGLContext current
QOpenGLContext::globalShareContext()->makeCurrent(surface);
#endif
if ( !QGLFormat::hasOpenGL() ) {
std::cerr << "This system has no OpenGL support.\n";
......
......@@ -52,7 +52,6 @@
#include <QtGlobal>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 4))
//only forward declaration
class QOpenGLWidget;
......@@ -61,12 +60,3 @@ class QSurfaceFormat;
typedef QOpenGLWidget OFGLWidget;
typedef QSurfaceFormat OFGLFormat;
#else
#include <QGLWidget>
#include <QGLFormat>
typedef QGLWidget OFGLWidget;
typedef QGLFormat OFGLFormat;
#endif
......@@ -211,12 +211,9 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
baseLayout_ = new QtMultiViewLayout;
baseLayout_->setContentsMargins(0,0,0,0);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 4))
glWidget_ = new OFGLWidget();
glWidget_->makeCurrent();
#else
glWidget_ = new OFGLWidget(format, 0);
#endif
PluginFunctions::shareGLWidget (glWidget_);
glView_ = new QtGLGraphicsView(stackedWidget_);
......
......@@ -131,9 +131,7 @@ glViewer::glViewer( QGraphicsScene* _scene,
projectionUpdateLocked_(false),
glScene_(_scene),
glWidget_(_glWidget),
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
glDebugLogger_(0),
#endif
pickCache_(0),
mouseCache_(nullptr),
updatePickCache_(true),
......@@ -233,21 +231,20 @@ glViewer::~glViewer()
void glViewer::makeCurrent() {
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,4))
const GLuint prevFbo = ACG::GLState::getFramebufferDraw();
const GLuint prevReadFbo = ACG::GLState::getFramebufferRead();
#endif
// calling makeCurrent binds the default FBO when QOpenGLWidget is used
makeWidgetCurrent();
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,4))
//restore the previously bound FBO, if it was not 0 as Qt Documentation says we shall not bind 0
if(prevFbo != 0)
ACG::GLState::bindFramebuffer(GL_DRAW_FRAMEBUFFER, prevFbo);
if(prevReadFbo != 0)
ACG::GLState::bindFramebuffer(GL_READ_FRAMEBUFFER, prevFbo);
#endif
}
......
......@@ -116,10 +116,9 @@ class QOpenGLFramebufferObject;
class QOpenGLFramebufferObjectFormat;
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
class QOpenGLDebugLogger;
class QOpenGLDebugMessage;
#endif
//== CLASS DEFINITION =========================================================
......@@ -535,10 +534,9 @@ protected slots:
virtual void cleanupEventFilter()
{ removeEventFilter( sender());}
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
/// process opengl debug messages
void processGLDebugMessage(const QOpenGLDebugMessage& msg);
#endif
//----------------------------------------------------------- private functions
private:
......@@ -631,10 +629,9 @@ private:
// Default VAO needed in core profile mode
ACG::VertexArrayObject defaultVAO_;
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
// Get additional debug info from OpenGL
QOpenGLDebugLogger* glDebugLogger_;
#endif
//===========================================================================
/** @name Wheels
......
......@@ -65,13 +65,10 @@
#include <OpenFlipper/common/GlobalOptions.hh>
#include <QOffscreenSurface>
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,4))
#include <QOpenGLContext>
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
#include <QOpenGLContext>
#include <QOpenGLDebugLogger>
#endif
#include <QOpenGLWidget>
#include <QOpenGLFramebufferObject>
......@@ -85,18 +82,16 @@
void glViewer::swapBuffers() {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 4))
glWidget_->context()->swapBuffers(glWidget_->context()->surface());
#else
glWidget_->swapBuffers();
#endif
}
//-----------------------------------------------------------------------------
void glViewer::startGLDebugLogger()
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
if (OpenFlipper::Options::debug())
{
delete glDebugLogger_;
......@@ -107,23 +102,19 @@ void glViewer::startGLDebugLogger()
glDebugLogger_->startLogging(QOpenGLDebugLogger::SynchronousLogging);
}
}
#endif
}
//-----------------------------------------------------------------------------
void glViewer::deleteGLDebugLogger()
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
makeCurrent();
delete glDebugLogger_;
#endif
}
//-----------------------------------------------------------------------------
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
void glViewer::processGLDebugMessage(const QOpenGLDebugMessage& msg)
{
if (msg.severity() & QOpenGLDebugMessage::HighSeverity)
......@@ -134,7 +125,6 @@ void glViewer::processGLDebugMessage(const QOpenGLDebugMessage& msg)
std::cerr << msg.message().toStdString() << std::endl;
}
#endif
//-----------------------------------------------------------------------------
......@@ -145,14 +135,7 @@ glViewer::copyToImage( QImage& _image,
GLenum /* _buffer */ )
{
// makeCurrent();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 4))
_image = glWidget_->grabFramebuffer()
#else
_image = glWidget_->grabFrameBuffer(true)
#endif
.copy(_l, _t, _w, _h).convertToFormat(QImage::Format_RGB32);
_image = glWidget_->grabFramebuffer().copy(_l, _t, _w, _h).convertToFormat(QImage::Format_RGB32);
}
//-----------------------------------------------------------------------------
......
......@@ -67,9 +67,8 @@
#include "simpleViewer.hh"
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
#include <QOpenGLWidget>
#endif
//== NAMESPACES ===============================================================
......@@ -117,12 +116,8 @@ void SimpleViewer::initialize(const OFGLFormat & _format, OFGLWidget *_shareWidg
connect (&props_, SIGNAL( setActionMode(const Viewer::ActionMode) ),
this, SLOT( setActionMode(const Viewer::ActionMode)), Qt::DirectConnection );
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
glWidget_ = new OFGLWidget();
glWidget_->setFormat(_format);
#else
glWidget_ = new OFGLWidget(_format, 0, _shareWidget);
#endif
setFocusPolicy (Qt::StrongFocus);
setAcceptDrops (true);
......
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