Graphics card profiles: Difference between revisions

Jump to navigation Jump to search
m
Line 236: Line 236:
}}
}}


<syntaxhighlight lang="diff">diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx
<syntaxhighlight lang="diff">diff --git a/src/GUI/gui.cxx b/src/GUI/gui.cxx
index b7fea20..615d0a9 100644
index b8a8f33..59f6dbf 100644
--- a/src/Main/fg_init.cxx
--- a/src/GUI/gui.cxx
+++ b/src/Main/fg_init.cxx
+++ b/src/GUI/gui.cxx
@@ -469,7 +469,24 @@ int fgInitConfig ( int argc, char **argv, bool reinit )
@@ -109,8 +109,31 @@ struct GeneralInitOperation : public GraphicsContextOperation
      SG_LOG(SG_INPUT, SG_INFO, "Reading global preferences");
        : GraphicsContextOperation(std::string("General init"))
      fgLoadProps("preferences.xml", globals->get_props());
    {
      SG_LOG(SG_INPUT, SG_INFO, "Finished Reading global preferences");
    }
-       
+    ~GeneralInitOperation() {
+     
+ SG_LOG(SG_GL, SG_INFO, "GeneralInitOperation finished");
+     // Next, try to load defaults for /sim/rendering
+    }
+     SGPropertyNode* fgroot = globals->get_props();
+
+     try {
+   void applyGraphicsProfile() {
+      SGPropertyNode* rendering = fgroot->getNode("/sim/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");
+
+
      // do not load user settings when reset to default is requested, or if
+ if(fgGetNode("/sim/startup")->getBoolValue("enable-gpu-profiles",true)) {
      // told to explicitly ignore
+ applyGraphicsProfile();
      if (options->isOptionSet("restore-defaults") || options->isOptionSet("ignore-autosave"))
+ }
+ else SG_LOG(SG_GL, SG_INFO, "NOT applying standard gpu profiles!");
    }
};


</syntaxhighlight>
</syntaxhighlight>

Navigation menu