Skip to content

Commit

Permalink
Add option to request a GLES context
Browse files Browse the repository at this point in the history
  • Loading branch information
loganmc10 committed Mar 19, 2018
1 parent 8e44ef5 commit b1283b9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions main.cpp
Expand Up @@ -13,8 +13,10 @@ int main(int argc, char *argv[])
parser.addHelpOption();
QCommandLineOption verboseOption({"v", "verbose"}, "Verbose mode. Prints out more information to log.");
QCommandLineOption noGUIOption("nogui", "Disable GUI elements.");
QCommandLineOption GLESOption("gles", "Request an OpenGL ES Context.");
parser.addOption(verboseOption);
parser.addOption(noGUIOption);
parser.addOption(GLESOption);
parser.addPositionalArgument("ROM", QCoreApplication::translate("main", "ROM to open."));
parser.process(a);
const QStringList args = parser.positionalArguments();
Expand All @@ -25,6 +27,8 @@ int main(int argc, char *argv[])
w->setVerbose();
if (parser.isSet(noGUIOption))
w->setNoGUI();
if (parser.isSet(GLESOption))
w->setGLES();
if (args.size() > 0)
w->openROM(args.at(0));

Expand Down
13 changes: 12 additions & 1 deletion mainwindow.cpp
Expand Up @@ -250,6 +250,7 @@ MainWindow::MainWindow(QWidget *parent) :
{
verbose = 0;
nogui = 0;
gles = 0;
ui->setupUi(this);

m_title = "mupen64plus-gui Build Date: ";
Expand Down Expand Up @@ -350,14 +351,24 @@ void MainWindow::setNoGUI()
statusBar()->hide();
}

void MainWindow::setGLES()
{
gles = 1;
}

int MainWindow::getNoGUI()
{
return nogui;
}

int MainWindow::getVerbose()
{
return verbose;
return verbose;
}

int MainWindow::getGLES()
{
return gles;
}

void MainWindow::resizeMainWindow(int Width, int Height)
Expand Down
3 changes: 3 additions & 0 deletions mainwindow.h
Expand Up @@ -22,6 +22,8 @@ class MainWindow : public QMainWindow
int getVerbose();
void setNoGUI();
int getNoGUI();
void setGLES();
int getGLES();
void updatePlugins();
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
Expand Down Expand Up @@ -84,6 +86,7 @@ private slots:
QMenu * OpenRecent;
int verbose;
int nogui;
int gles;
QString m_title;
};

Expand Down
3 changes: 3 additions & 0 deletions vidext.cpp
@@ -1,6 +1,7 @@
#include "vidext.h"
#include "common.h"
#include "workerthread.h"
#include "mainwindow.h"
#include <stdio.h>
#include <QDesktopWidget>

Expand All @@ -17,6 +18,8 @@ m64p_error qtVidExtFuncInit(void)
format->setProfile(QSurfaceFormat::CompatibilityProfile);
format->setMajorVersion(2);
format->setMinorVersion(1);
if (w->getGLES())
format->setRenderableType(QSurfaceFormat::OpenGLES);
return M64ERR_SUCCESS;
}

Expand Down

0 comments on commit b1283b9

Please sign in to comment.