From 8885c118ffc0540e00ee71dcd376e3780f5e67ce Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 19 Nov 2014 15:44:29 +0000 Subject: [PATCH] citra_qt: Add OpenGL configuration --- src/citra_qt/bootmanager.cpp | 18 ++++++++++++++---- src/citra_qt/config.cpp | 12 ++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 3e24da596..09fb0efd2 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -131,10 +131,20 @@ GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose QGLFormat fmt; - fmt.setVersion(3,2); - fmt.setProfile(QGLFormat::CoreProfile); - // Requests a forward-compatible context, which is required to get a 3.2+ context on OS X - fmt.setOption(QGL::NoDeprecatedFunctions); + fmt.setVersion(Settings::values.opengl_version_major, Settings::values.opengl_version_minor); + if (Settings::values.opengl_flavor == "core") { + fmt.setProfile(QGLFormat::CoreProfile); + // Requests a forward-compatible context, which is required to get a 3.2+ context on OS X + fmt.setOption(QGL::NoDeprecatedFunctions); + } else if (Settings::values.opengl_flavor == "gles") { + // TODO(Link Mauve): We need a way to tell Qt to give us a GLES context. + // A possible solution given by Subv, but unimplementable until we ditch Qt4: + // You could use QSurfaceFormat with RenderableType::OpenGLES and then get the QGLFormat + // with QGLFormat::fromSurfaceFormat. I am not sure if this would work. As a side note, + // all the QGL* (QGLFormat, QGLWidget, etc) classes have been deprecated as of Qt 5.4, so + // it might be worth it to check out the other alternatives + LOG_WARNING(Frontend, "GLES requested but ignored."); + } child = new GGLWidgetInternal(fmt, this); QBoxLayout* layout = new QHBoxLayout(this); diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index 1596c08d7..f0f3bbde2 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp @@ -48,6 +48,12 @@ void Config::ReadValues() { Settings::values.frame_skip = qt_config->value("frame_skip", 0).toInt(); qt_config->endGroup(); + qt_config->beginGroup("OpenGL"); + Settings::values.opengl_version_major = qt_config->value("version_major", 2).toInt(); + Settings::values.opengl_version_minor = qt_config->value("version_minor", 1).toInt(); + Settings::values.opengl_flavor = qt_config->value("flavor", QString("compatibility")).toString().toUtf8().constData(); + qt_config->endGroup(); + qt_config->beginGroup("Data Storage"); Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool(); qt_config->endGroup(); @@ -84,6 +90,12 @@ void Config::SaveValues() { qt_config->setValue("frame_skip", Settings::values.frame_skip); qt_config->endGroup(); + qt_config->beginGroup("OpenGL"); + qt_config->setValue("version_major", Settings::values.opengl_version_major); + qt_config->setValue("version_minor", Settings::values.opengl_version_minor); + qt_config->setValue("flavor", QString(Settings::values.opengl_flavor.c_str())); + qt_config->endGroup(); + qt_config->beginGroup("Data Storage"); qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd); qt_config->endGroup();