20,741
edits
Line 236: | Line 236: | ||
}} | }} | ||
<syntaxhighlight lang="diff">diff --git a/src/ | <syntaxhighlight lang="diff">diff --git a/src/GUI/gui.cxx b/src/GUI/gui.cxx | ||
index | index b8a8f33..59f6dbf 100644 | ||
--- a/src/ | --- a/src/GUI/gui.cxx | ||
+++ b/src/ | +++ b/src/GUI/gui.cxx | ||
@@ - | @@ -109,8 +109,31 @@ struct GeneralInitOperation : public GraphicsContextOperation | ||
: GraphicsContextOperation(std::string("General init")) | |||
{ | |||
} | |||
+ ~GeneralInitOperation() { | |||
+ | + SG_LOG(SG_GL, SG_INFO, "GeneralInitOperation finished"); | ||
+ | + } | ||
+ | + | ||
+ | + void applyGraphicsProfile() { | ||
+ SGPropertyNode* rendering = | + try { | ||
+ SGPropertyNode* rendering = fgGetNode("/sim/rendering"); | |||
+ std::string path = "Profiles/graphics.xml"; | + std::string path = "Profiles/graphics.xml"; | ||
+ if(rendering) { | + if(rendering) { | ||
+ SG_LOG(SG_INPUT, SG_INFO, "Loading graphics profiles from:" <<path); | + SG_LOG(SG_INPUT, SG_INFO, "Loading graphics profiles from:" <<path); | ||
+ //TODO: in its current form, this will overwrite autosave stuff | |||
+ fgLoadProps(path.c_str(), rendering); | + fgLoadProps(path.c_str(), rendering); | ||
+ } | + } | ||
Line 262: | Line 264: | ||
+ SG_LOG(SG_INPUT, SG_INFO, "caught generic exception trying to read graphics profile"); | + SG_LOG(SG_INPUT, SG_INFO, "caught generic exception trying to read graphics profile"); | ||
+ } | + } | ||
+ } // of applyGraphicsProfile | |||
+ | |||
void run(osg::GraphicsContext* gc) | |||
{ | |||
+ SG_LOG(SG_GL, SG_INFO, "OpenGL initialization"); | |||
SGPropertyNode* simRendering = fgGetNode("/sim/rendering"); | |||
simRendering->setStringValue("gl-vendor", (char*) glGetString(GL_VENDOR)); | |||
@@ -138,6 +161,12 @@ struct GeneralInitOperation : public GraphicsContextOperation | |||
glGetIntegerv( GL_DEPTH_BITS, &tmp ); | |||
simRendering->setIntValue("depth-buffer-bits", tmp); | |||
+ SG_LOG(SG_GL, SG_INFO, "OpenGL strings copied to property tree"); | |||
+ | + | ||
+ if(fgGetNode("/sim/startup")->getBoolValue("enable-gpu-profiles",true)) { | |||
+ applyGraphicsProfile(); | |||
+ } | |||
+ else SG_LOG(SG_GL, SG_INFO, "NOT applying standard gpu profiles!"); | |||
} | |||
}; | |||
</syntaxhighlight> | </syntaxhighlight> |