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

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