Commit 5c602118 authored by Martin Schultz's avatar Martin Schultz

added Options for OpenGL version and profile, also changed samples

option to enable overwriting
parent 15ebce8d
...@@ -138,6 +138,15 @@ static bool stereo_ = true; ...@@ -138,6 +138,15 @@ static bool stereo_ = true;
/// Use opengl core profile mode? /// Use opengl core profile mode?
static bool coreProfile_ = false; static bool coreProfile_ = false;
static bool profileOverride_ = false;
/// Requested Opengl version
static QPair<int,int> version_ {4,6};
static bool versionOverride_ = false;
/// Requested OpenGL multisampling
static int samples_ = 4;
static bool samplesOverride_ = false;
/// Store the opengl stereo support /// Store the opengl stereo support
static bool glStereo_ = true; static bool glStereo_ = true;
...@@ -378,23 +387,61 @@ bool stereo( ) { ...@@ -378,23 +387,61 @@ bool stereo( ) {
} }
/// Store opengl core profile setting /// Store opengl core profile setting
void coreProfile( bool _enableCoreProfile ) { void coreProfile( bool _enableCoreProfile, bool _temporary ) {
coreProfile_ = _enableCoreProfile; if(_temporary)
{
profileOverride_ = true;
coreProfile_ = _enableCoreProfile;
}
else
OpenFlipperSettings().setValue("Core/OpenGL/CoreProfile",_enableCoreProfile);
} }
/// get opengl core profile setting /// get opengl core profile setting
bool coreProfile( ) { bool coreProfile( ) {
return coreProfile_; if(profileOverride_)
return coreProfile_;
else
return OpenFlipperSettings().value("Core/OpenGL/CoreProfile",true).toBool();
} }
/// get opengl version setting
QPair<int,int> glVersion(){
if(versionOverride_)
return version_;
else
return OpenFlipperSettings().value("Core/OpenGL/Version",QVariant::fromValue(QPair<int,int>(4,6))).value<QPair<int,int>>();
}
/// Store opengl version setting
void glVersion(const QPair<int,int> & _version, bool _temporary)
{
//possible enhancement: check for validity
if(_temporary)
{
version_ = _version;
versionOverride_ = true;
}
else
OpenFlipperSettings().setValue("Core/OpenGL/Version",QVariant::fromValue(_version));
}
/// Store opengl MSAA sample count /// Store opengl MSAA sample count
void samples(int _samples) { void samples(int _samples, bool _temporary) {
OpenFlipperSettings().setValue("Core/OpenGL/Samples",_samples); if(_temporary)
{
samples_ = _samples;
samplesOverride_ = true;
}
else
OpenFlipperSettings().setValue("Core/OpenGL/Samples",_samples);
} }
/// Get opengl MSAA sample count /// Get opengl MSAA sample count
int samples() { int samples() {
return OpenFlipperSettings().value("Core/OpenGL/Samples",4).toInt(); if(samplesOverride_)
return samples_;
else
return OpenFlipperSettings().value("Core/OpenGL/Samples",4).toInt();
} }
/// Store opengl stereo mode setting /// Store opengl stereo mode setting
......
...@@ -417,15 +417,21 @@ QString helpDirStr(); ...@@ -417,15 +417,21 @@ QString helpDirStr();
/// Store opengl core profile setting /// Store opengl core profile setting
DLLEXPORT DLLEXPORT
void coreProfile(bool _enableCoreProfile); void coreProfile(bool _enableCoreProfile, bool _temporary = false);
/// get opengl core profile setting /// get opengl core profile setting
DLLEXPORT DLLEXPORT
bool coreProfile( ); bool coreProfile( );
/// get opengl version setting
QPair<int,int> glVersion();
/// set opengl version setting
void glVersion(const QPair<int, int>& _version, bool _teporary = false);
/// Store opengl MSAA sample count /// Store opengl MSAA sample count
DLLEXPORT DLLEXPORT
void samples(int _samples); void samples(int _samples, bool _temporary = false);
/// Get opengl MSAA sample count /// Get opengl MSAA sample count
DLLEXPORT DLLEXPORT
......
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