From 0f6565f764392e8373e353412a09f6f4ae62aaf1 Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 31 Aug 1999 23:22:05 +0000 Subject: [PATCH] Patch to allow window resizes. --- src/Main/main.cxx | 2 ++ src/Main/options.cxx | 31 ++++++++++++++++++++----------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 9eab93ed8..8820f7f6d 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -908,6 +908,8 @@ void fgReshape( int width, int height ) { current_view.set_winHeight( height ); current_view.force_update_fov_math(); + glViewport ( 0, 0, width, height ); + if ( idle_state == 1000 ) { // yes we've finished all our initializations and are running // the main loop, so this will now work without seg faulting diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 2fbced19d..8e9470973 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -670,20 +670,29 @@ int fgOPTIONS::parse_option( const string& arg ) { } else if ( arg == "--enable-wireframe" ) { wireframe = true; } else if ( arg.find( "--geometry=" ) != string::npos ) { + bool geometry_ok = true; string geometry = arg.substr( 11 ); - if ( geometry == "640x480" ) { + string::size_type i = geometry.find('x'); + + if (i != string::npos) { + xsize = atoi(geometry.substr(0, i)); + ysize = atoi(geometry.substr(i+1)); + // cout << "Geometry is " << xsize << 'x' << ysize << '\n'; + } else { + geometry_ok = false; + } + + if ( xsize <= 0 || ysize <= 0 ) { xsize = 640; ysize = 480; - } else if ( geometry == "800x600" ) { - xsize = 800; - ysize = 600; - } else if ( geometry == "1024x768" ) { - xsize = 1024; - ysize = 768; - } else { - FG_LOG( FG_GENERAL, FG_ALERT, "Unknown geometry: " << geometry ); - exit(-1); - } + geometry_ok = false; + } + + if ( !geometry_ok ) { + FG_LOG( FG_GENERAL, FG_ALERT, "Unknown geometry: " << geometry ); + FG_LOG( FG_GENERAL, FG_ALERT, + "Setting geometry to " << xsize << 'x' << ysize << '\n'); + } } else if ( arg == "--units-feet" ) { units = FG_UNITS_FEET; } else if ( arg == "--units-meters" ) {