From: Erik Hofman Date: Sat, 19 Mar 2016 12:10:36 +0000 (+0100) Subject: Add support for Video adapter rendering presets X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e1bb47bc8938dd51a6159209665ce0575aac1bbc;p=flightgear.git Add support for Video adapter rendering presets --- diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 996c05fa9..d17015589 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -26,6 +26,7 @@ #endif #include +#include #include @@ -149,6 +150,36 @@ static void initTerrasync() terra_sync->init(); } +static void fgSetVideoOptions() +{ + std::string vendor = fgGetString("/sim/rendering/gl-vendor"); + SGPath path(globals->get_fg_root()); + path.append("Video"); + path.append(vendor); + if (path.exists()) + { + std::string renderer = fgGetString("/sim/rendering/gl-renderer"); + size_t pos = renderer.find('/'); + if (pos == std::string::npos) { + pos = renderer.find(" ("); + } + if (pos != std::string::npos) { + renderer = renderer.substr(0, pos); + } + path.append(renderer+".xml"); + if (path.exists()) { + SG_LOG(SG_INPUT, SG_INFO, "Reading video settings from " << path.str()); + try { + SGPropertyNode *r_prop = fgGetNode("/sim/rendering"); + readProperties(path.str(), r_prop); + } catch (sg_exception& e) { + SG_LOG(SG_INPUT, SG_WARN, "failed to read video settings:" << e.getMessage() + << "(from " << e.getOrigin() << ")"); + } + } + } +} + static void checkOpenGLVersion() { #if defined(SG_MAC) @@ -206,6 +237,7 @@ static void fgIdleFunction ( void ) { if (guiInit()) { checkOpenGLVersion(); + fgSetVideoOptions(); idle_state+=2; fgSplashProgress("loading-aircraft-list"); }