Commit 7580642d authored by Martin Schultz's avatar Martin Schultz

added Command line options to set the requested OpenGL version and

samples. E.G. use -glVersion 3.2 -samples 4
parent 5c602118
......@@ -350,8 +350,14 @@ CommandLineParseResult parseCommandLine(QCommandLineParser &parser, QString *err
QCommandLineOption coreProfileOption("core-profile",QCoreApplication::translate("main", "OpenGL Core Profile Mode"));
parser.addOption(coreProfileOption);
QCommandLineOption profileOption("profile",QCoreApplication::translate("main","Request OpenGL context profile <profile> with profile set as compat or core"),QCoreApplication::translate("main","<compat | core >"));
QCommandLineOption glVersionOption("glVersion",QCoreApplication::translate("main","Request OpenGL version <major>.<minor> "),QCoreApplication::translate("main","< 1.0 | 1.1 | ... | 4.6 >"));
parser.addOption(glVersionOption);
QCommandLineOption samplesOption("samples",QCoreApplication::translate("main","Overwrite multisampling sample count"),QCoreApplication::translate("main","< 0 | 1 | 2 | ... | 16 >"));
parser.addOption(samplesOption);
QCommandLineOption profileOption("profile",QCoreApplication::translate("main","Request OpenGL context profile <profile> with profile set as compat or core"),QCoreApplication::translate("main","< compat | core >"));
profileOption.setDefaultValue("compat");
parser.addOption(profileOption);
const QCommandLineOption helpOption = parser.addHelpOption();
......@@ -415,20 +421,30 @@ CommandLineParseResult parseCommandLine(QCommandLineParser &parser, QString *err
std::cerr << "Got port option : " << port.toStdString() << std::endl;
OpenFlipper::Options::remoteControl(port.toInt());
}
if(parser.isSet("samples"))
OpenFlipper::Options::samples(parser.value("samples").toInt(),true);
if(parser.isSet("glVersion"))
{
QStringList values = parser.value("glVersion").split(".");
QPair<int,int> version(
values[0].toInt(),
values[1].toInt());
OpenFlipper::Options::glVersion(version,true);
}
if(parser.value(profileOption)=="core")
{
OpenFlipper::Options::coreProfile(true);
OpenFlipper::Options::coreProfile(true, true);
}
else
{
if(parser.value(profileOption)=="compat")
{
OpenFlipper::Options::coreProfile(false);
OpenFlipper::Options::coreProfile(false, true);
}
}
if(parser.isSet(coreProfileOption)) {
OpenFlipper::Options::coreProfile(true);
OpenFlipper::Options::coreProfile(true, true);
}
return CommandLineOk;
......@@ -514,7 +530,8 @@ int main(int argc, char **argv)
#if QT_VERSION >= 0x050500
QSurfaceFormat format;
format.setVersion(4, 4);
QPair<int,int> version = OpenFlipper::Options::glVersion();
format.setVersion(version.first, version.second);
if (OpenFlipper::Options::coreProfile())
{
......@@ -525,9 +542,9 @@ int main(int argc, char **argv)
format.setOption(QSurfaceFormat::DeprecatedFunctions);
}
format.setSamples(OpenFlipper::Options::samples());
if (OpenFlipper::Options::debug())
format.setOption(format.options() | QSurfaceFormat::DebugContext);
format.setOption(format.options() | QSurfaceFormat::DebugContext);
QSurfaceFormat::setDefaultFormat(format);
......
......@@ -253,7 +253,8 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
#if QT_VERSION >= 0x050000
// request the highest OpenGL version
// QT 5 should gracefully provide the next highest available version
format.setVersion(4, 0);
QPair<int, int> version = OpenFlipper::Options::glVersion();
format.setVersion(version.first, version.second);
format.setProfile(OFGLFormat::CoreProfile);
#else
format.setProfile(OFGLFormat::CompatibilityProfile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment