From 05831bea95a0f8a33a3202a7c99025685d93123a Mon Sep 17 00:00:00 2001 From: Jannik Vogel Date: Mon, 8 Aug 2016 06:30:11 +0200 Subject: [PATCH] RWViewer: Use OpenGL 3.3 Core to prevent crash --- rwviewer/ViewerWidget.cpp | 4 ++-- rwviewer/ViewerWidget.hpp | 2 +- rwviewer/ViewerWindow.cpp | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/rwviewer/ViewerWidget.cpp b/rwviewer/ViewerWidget.cpp index ee96988d..c470a689 100644 --- a/rwviewer/ViewerWidget.cpp +++ b/rwviewer/ViewerWidget.cpp @@ -15,8 +15,8 @@ #include -ViewerWidget::ViewerWidget(QWidget* parent, const QGLWidget* shareWidget, Qt::WindowFlags f) - : QGLWidget(parent, shareWidget, f) +ViewerWidget::ViewerWidget(QGLFormat g, QWidget* parent, const QGLWidget* shareWidget, Qt::WindowFlags f) + : QGLWidget(g, parent, shareWidget, f) , gworld(nullptr) , activeModel(nullptr) , selectedFrame(nullptr) diff --git a/rwviewer/ViewerWidget.hpp b/rwviewer/ViewerWidget.hpp index 9a423080..55096ee3 100644 --- a/rwviewer/ViewerWidget.hpp +++ b/rwviewer/ViewerWidget.hpp @@ -52,7 +52,7 @@ class ViewerWidget : public QGLWidget void drawFrameWidget(ModelFrame* f, const glm::mat4& = glm::mat4(1.f)); public: - ViewerWidget(QWidget* parent = 0, const QGLWidget* shareWidget = 0, Qt::WindowFlags f = 0); + ViewerWidget(QGLFormat g, QWidget* parent = 0, const QGLWidget* shareWidget = 0, Qt::WindowFlags f = 0); virtual void initializeGL(); diff --git a/rwviewer/ViewerWindow.cpp b/rwviewer/ViewerWindow.cpp index 54a081c2..b4854b56 100644 --- a/rwviewer/ViewerWindow.cpp +++ b/rwviewer/ViewerWindow.cpp @@ -46,7 +46,12 @@ ViewerWindow::ViewerWindow(QWidget* parent, Qt::WindowFlags flags) connect(ex, SIGNAL(triggered()), QApplication::instance(), SLOT(closeAllWindows())); //----------------------- View Mode setup - viewerWidget = new ViewerWidget; + + QGLFormat glFormat; + glFormat.setVersion( 3, 3 ); + glFormat.setProfile( QGLFormat::CoreProfile ); + + viewerWidget = new ViewerWidget(glFormat); viewerWidget->context()->makeCurrent(); connect(this, SIGNAL(loadedData(GameWorld*)), viewerWidget, SLOT(dataLoaded(GameWorld*)));