citra_qt: Add OpenGL configuration

This commit is contained in:
Emmanuel Gil Peyrot 2014-11-19 15:44:29 +00:00
parent 22c2d51e21
commit 8885c118ff
2 changed files with 26 additions and 4 deletions

View file

@ -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.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);

View file

@ -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();