]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/main.cxx
Various MSVC patches.
[flightgear.git] / src / Main / main.cxx
index e1c20d71625bcf986848582a589aa2c9d7a38685..0a841f6da82c6096b630f7c5f6529865885b4ade 100644 (file)
 // Should already be inlcluded by gl.h if needed by your platform so
 // we shouldn't include this here.
 // #include <GL/glext.h>
-PFNGLPOINTPARAMETERFEXTPROC glPointParameterfEXT = 0;
-PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvEXT = 0;
+// PFNGLPOINTPARAMETERFEXTPROC glPointParameterfEXT = 0;
+// PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvEXT = 0;
 float default_attenuation[3] = {1.0, 0.0, 0.0};
 //Required for using GL_extensions
 void fgLoadDCS (void);
@@ -684,7 +684,7 @@ void fgRenderFrame( void ) {
        // glMatrixMode( GL_PROJECTION );
        // glLoadIdentity();
        float fov = globals->get_current_view()->get_fov();
-       ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
+       ssgSetFOV(fov, fov * globals->get_current_view()->get_fov_ratio());
 
        double agl = current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER
            - scenery.cur_elev;
@@ -1391,36 +1391,28 @@ static void fgIdleFunction ( void ) {
 // options.cxx needs to see this for toggle_panel()
 // Handle new window size or exposure
 void fgReshape( int width, int height ) {
+    int view_h;
+
+    if ( fgPanelVisible() && idle_state == 1000 ) {
+       view_h = (int)(height * (current_panel->getViewHeight() -
+                                current_panel->getYOffset()) / 768.0);
+    } else {
+       view_h = height;
+    }
+
     // for all views
     for ( int i = 0; i < globals->get_viewmgr()->size(); ++i ) {
-       if ( ! fgPanelVisible() || idle_state != 1000 ) {
-           globals->get_viewmgr()->get_view(i)->
-               set_win_ratio( (float)height / (float)width );
-       } else {
-           int view_h =
-               int((current_panel->getViewHeight() -
-                    current_panel->getYOffset())
-                   * (height / 768.0)) + 1;
-           globals->get_viewmgr()->get_view(i)->
-               set_win_ratio( (float)view_h / (float)width );
-       }
+       globals->get_viewmgr()->get_view(i)->
+            set_aspect_ratio((float)view_h / (float)width);
     }
 
-    if ( ! fgPanelVisible() || idle_state != 1000 ) {
-       glViewport(0, 0 , (GLint)(width), (GLint)(height) );
-    } else {
-        int view_h =
-           int((current_panel->getViewHeight() - current_panel->getYOffset())
-               * (height / 768.0)) + 1;
-       glViewport(0, (GLint)(height - view_h),
-                  (GLint)(width), (GLint)(view_h) );
-    }
+    glViewport( 0, (GLint)(height - view_h), (GLint)(width), (GLint)(view_h) );
 
     fgSetInt("/sim/startup/xsize", width);
     fgSetInt("/sim/startup/ysize", height);
 
     float fov = globals->get_current_view()->get_fov();
-    ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
+    ssgSetFOV(fov, fov * globals->get_current_view()->get_fov_ratio());
 
     fgHUDReshape();
 }
@@ -1523,10 +1515,6 @@ int mainLoop( int argc, char **argv ) {
     argc = ccommand( &argv );
 #endif
 
-#ifdef HAVE_BC5PLUS
-    _control87(MCW_EM, MCW_EM);  /* defined in float.h */
-#endif
-
     // set default log levels
     sglog().setLogLevels( SG_ALL, SG_INFO );
 
@@ -1866,16 +1854,28 @@ int mainLoop( int argc, char **argv ) {
 
 // Main entry point; catch any exceptions that have made it this far.
 int main ( int argc, char **argv ) {
-                               // FIXME: add other, more specific
-                               // exceptions.
-  try {
-    mainLoop(argc, argv);
-  } catch (sg_throwable &t) {
-    SG_LOG(SG_GENERAL, SG_ALERT,
-          "Fatal error: " << t.getFormattedMessage()
-          << "\n (received from " << t.getOrigin() << ')');
-    exit(1);
-  }
+
+#if defined( _MSC_VER ) && defined( DEBUG )
+    // Christian, we should document what this does
+    _control87( _EM_INEXACT, _MCW_EM );
+#endif
+
+#if defined( HAVE_BC5PLUS )
+    _control87(MCW_EM, MCW_EM);  /* defined in float.h */
+#endif
+
+    // FIXME: add other, more specific
+    // exceptions.
+    try {
+        mainLoop(argc, argv);
+    } catch (sg_throwable &t) {
+        SG_LOG(SG_GENERAL, SG_ALERT,
+               "Fatal error: " << t.getFormattedMessage()
+               << "\n (received from " << t.getOrigin() << ')');
+        exit(1);
+    }
+
+    return 0;
 }
 
 
@@ -1966,7 +1966,7 @@ void fgLoadDCS(void) {
                                                SG_LOG( SG_TERRAIN, SG_ALERT, "Cannot open file: " << modelpath.str() );
                                        } else {
                                                while ( ! in1.eof() ) {
-                                                       in1 >> skipws;
+                                                        in1 >> ::skipws;
                                                        if ( in1.get( c ) && c == '#' ) { 
                                                                in1 >> skipeol;
                                                        } else {