diff --git a/CHANGES b/CHANGES index e93897927..b0fcb8616 100644 --- a/CHANGES +++ b/CHANGES @@ -18,6 +18,7 @@ Misc: - OpenGL: Add texSize uniform - ARM7: Clean up instruction decoding for future expandability - Qt: Make -g flag work in Qt build + - Qt: Simplify OpenGL context creation 0.4.1: (2016-07-11) Bugfixes: diff --git a/src/platform/qt/Display.cpp b/src/platform/qt/Display.cpp index b231f0ebc..2bd772836 100644 --- a/src/platform/qt/Display.cpp +++ b/src/platform/qt/Display.cpp @@ -29,11 +29,13 @@ Display* Display::create(QWidget* parent) { switch (s_driver) { #if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(USE_EPOXY) case Driver::OPENGL: - return new DisplayGL(format, false, parent); + format.setVersion(3, 0); + return new DisplayGL(format, parent); #endif #ifdef BUILD_GL case Driver::OPENGL1: - return new DisplayGL(format, true, parent); + format.setVersion(1, 4); + return new DisplayGL(format, parent); #endif case Driver::QT: @@ -41,7 +43,8 @@ Display* Display::create(QWidget* parent) { default: #if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(USE_EPOXY) - return new DisplayGL(format, false, parent); + format.setVersion(3, 0); + return new DisplayGL(format, parent); #else return new DisplayQt(parent); #endif diff --git a/src/platform/qt/DisplayGL.cpp b/src/platform/qt/DisplayGL.cpp index a43ba6e88..3dc43acdd 100644 --- a/src/platform/qt/DisplayGL.cpp +++ b/src/platform/qt/DisplayGL.cpp @@ -24,22 +24,14 @@ extern "C" { using namespace QGBA; -DisplayGL::DisplayGL(const QGLFormat& format, bool force1, QWidget* parent) +DisplayGL::DisplayGL(const QGLFormat& format, QWidget* parent) : Display(parent) , m_isDrawing(false) , m_gl(new EmptyGLWidget(format, this)) , m_drawThread(nullptr) , m_context(nullptr) { - QGLFormat::OpenGLVersionFlags versions = QGLFormat::openGLVersionFlags(); - if (force1) { - versions &= QGLFormat::OpenGL_Version_1_1 | - QGLFormat::OpenGL_Version_1_2 | - QGLFormat::OpenGL_Version_1_3 | - QGLFormat::OpenGL_Version_1_4 | - QGLFormat::OpenGL_Version_1_5; - } - m_painter = new PainterGL(m_gl, versions); + m_painter = new PainterGL(format.majorVersion(), m_gl); m_gl->setMouseTracking(true); m_gl->setAttribute(Qt::WA_TransparentForMouseEvents); // This doesn't seem to work? } @@ -179,7 +171,7 @@ void DisplayGL::resizePainter() { } } -PainterGL::PainterGL(QGLWidget* parent, QGLFormat::OpenGLVersionFlags glVersion) +PainterGL::PainterGL(int majorVersion, QGLWidget* parent) : m_gl(parent) , m_active(false) , m_started(false) @@ -196,7 +188,7 @@ PainterGL::PainterGL(QGLWidget* parent, QGLFormat::OpenGLVersionFlags glVersion) #endif #if !defined(_WIN32) || defined(USE_EPOXY) - if (glVersion & (QGLFormat::OpenGL_Version_3_0 | QGLFormat::OpenGL_ES_Version_2_0)) { + if (majorVersion >= 2) { gl2Backend = new mGLES2Context; mGLES2ContextCreate(gl2Backend); m_backend = &gl2Backend->d; diff --git a/src/platform/qt/DisplayGL.h b/src/platform/qt/DisplayGL.h index a98518e46..5803dfd92 100644 --- a/src/platform/qt/DisplayGL.h +++ b/src/platform/qt/DisplayGL.h @@ -43,7 +43,7 @@ class DisplayGL : public Display { Q_OBJECT public: - DisplayGL(const QGLFormat& format, bool force1 = false, QWidget* parent = nullptr); + DisplayGL(const QGLFormat& format, QWidget* parent = nullptr); ~DisplayGL(); bool isDrawing() const override { return m_isDrawing; } @@ -80,7 +80,7 @@ class PainterGL : public QObject { Q_OBJECT public: - PainterGL(QGLWidget* parent, QGLFormat::OpenGLVersionFlags = QGLFormat::OpenGL_Version_1_1); + PainterGL(int majorVersion, QGLWidget* parent); ~PainterGL(); void setContext(mCoreThread*);