+
+ SGPath p(dir);
+ p.append(filename);
+ if (!p.exists()) {
+ path.set(p.str());
+ break;
+ }
+ }
+
+ int result = sg_glDumpWindow(path.c_str(),
+ fgGetInt("/sim/startup/xsize"),
+ fgGetInt("/sim/startup/ysize"));
+
+ fgSetString("/sim/paths/screenshot-last", path.c_str());
+ fgSetBool("/sim/signals/screenshot", false);
+
+ fgSetMouseCursor(mouse);
+
+ if ( !freeze ) {
+ fgSetBool("/sim/freeze/master", false);
+ }
+ return result != 0;
+}
+
+// do an entire scenegraph dump
+void fgDumpSceneGraph()
+{
+ char *filename = new char [24];
+ string message;
+ static int count = 1;
+
+ static const SGPropertyNode *master_freeze
+ = fgGetNode("/sim/freeze/master");
+
+ bool freeze = master_freeze->getBoolValue();
+ if ( !freeze ) {
+ fgSetBool("/sim/freeze/master", true);
+ }
+
+ while (count < 1000) {
+ FILE *fp;
+ snprintf(filename, 24, "fgfs-graph-%03d.osg", count++);