20,741
edits
m (→Proof of concept (patch): https://forum.flightgear.org/viewtopic.php?f=36&t=30050&p=314434#) |
|||
Line 144: | Line 144: | ||
}} | }} | ||
</ref> | </ref> | ||
<syntaxhighlight lang="diff"> | |||
diff --git a/src/Main/options.cxx b/src/Main/options.cxx | |||
index db5d84d..fb63dd1 100644 | |||
--- a/src/Main/options.cxx | |||
+++ b/src/Main/options.cxx | |||
@@ -1797,6 +1797,7 @@ struct OptionDesc { | |||
{"prop", true, OPTION_FUNC | OPTION_MULTI, "", false, "", fgOptSetProperty}, | |||
{"load-tape", true, OPTION_FUNC, "", false, "", fgOptLoadTape }, | |||
{"developer", true, OPTION_IGNORE | OPTION_BOOL, "", false, "", nullptr }, | |||
+ {"enable-headless", false, OPTION_BOOL, "/sim/startup/headless-mode", true, "",0 }, | |||
{0} | |||
}; | |||
diff --git a/src/Viewer/WindowBuilder.cxx b/src/Viewer/WindowBuilder.cxx | |||
index f4d3c33..a1ffb84 100644 | |||
--- a/src/Viewer/WindowBuilder.cxx | |||
+++ b/src/Viewer/WindowBuilder.cxx | |||
@@ -149,6 +149,12 @@ void WindowBuilder::makeDefaultTraits(bool stencil) | |||
SG_LOG(SG_VIEW,SG_DEBUG,"Using initial window size: " << w << " x " << h); | |||
} | |||
} | |||
+bool headless = fgGetBool("/sim/startup/headless-mode", false); | |||
+if (headless) { | |||
+ SG_LOG(SG_VIEW, SG_ALERT, "Headless view required: rendering window to pbuffer"); | |||
+ traits->pbuffer = true; | |||
+} // enable headless | |||
+ | |||
} | |||
} // of namespace flightgear | |||
</syntaxhighlight> | |||
For reference, to disable the window. It's the last thing before the return statement in WindowBuilder::makeDefaultTraits(bool stencil): | For reference, to disable the window. It's the last thing before the return statement in WindowBuilder::makeDefaultTraits(bool stencil): |