I'm a complete noob to FlightGear, so my apology in advance if this is 
an FAQ, but I did make a reasonable attempt at searching for this as a 
known issue.

When running the opengl (glut) version of fgfs on linux, if I use the 
--enable-game-mode option, it sets the display correctly and all works 
beautifully.  However, once I leave fgfs, the screen resolution stays 
set to whatever I specified on the fgfs command line instead of 
reverting to the original desktop size.

I couldn't find a solution to this, but after quite a bit of searching, 
I found that fgfs tells glut to enter 'game mode' on initialisation, but 
never tells it to leave.  Not sure if this perhaps happens automatically 
on exit with the Windows glut libraries, but it doesn't seem to with the 
freeglut build I am using.  (freeglut 2.4.0 on Fedora 10)

So, I added an atexit() callback for glutLeaveGameMode() and now it 
correctly reverts to the original screen resolution when I exit.

diff -c fg_os.cxx fg_os-patch.cxx
*** fg_os.cxx    2008-12-14 17:02:22.738051861 +1100
--- fg_os-patch.cxx    2008-12-14 17:20:30.222473945 +1100
***************
*** 233,238 ****
--- 233,239 ----
          }
          glutGameModeString( game_mode_str );
          glutEnterGameMode();
+         atexit(glutLeaveGameMode);
      }
 
      // Register these here.  Calling them before the window is open

I would have preferred not to add another exit callback, but there 
didn't seem to be anywhere else sensible for it.  fgOSExit() seemed like 
the logical place, but that doesn't seem to be always (ever?) called on 
exit.

Anyway, I'm now running happily with my patched fgfs.  Just thought I 
would mail this to the list in case it is generally useful.  (or perhaps 
someone can tell me why it is a bad idea)

Thanks,
Peter.

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to