diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 4556c9e57..b9ed5d85c 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -1587,6 +1587,10 @@ bool fgInitSubsystems() { globals->add_subsystem("lighting", new FGLight); + ////////////////////////////////////////////////////////////////////// + // Initialize the 2D cloud subsystem. + //////////////////////////////////////////////////////////////////// + fgGetNode("/sim/rendering/bump-mapping", true); #ifdef FG_USE_CLOUDS_3D //////////////////////////////////////////////////////////////////// diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 809ae0a32..1f7032f8a 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -331,7 +331,7 @@ void trRenderFrame( void ) { // and update the stencil buffer with 1 glEnable( GL_STENCIL_TEST ); glStencilFunc( GL_ALWAYS, 1, 1 ); - glStencilOp( GL_REPLACE, GL_REPLACE, GL_REPLACE ); + glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE ); } FGTileMgr::set_tile_filter( false ); sgSetModelFilter( true ); @@ -701,7 +701,7 @@ void fgRenderFrame() { // and update the stencil buffer with 1 glEnable( GL_STENCIL_TEST ); glStencilFunc( GL_ALWAYS, 1, 1 ); - glStencilOp( GL_REPLACE, GL_REPLACE, GL_REPLACE ); + glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE ); } FGTileMgr::set_tile_filter( false ); sgSetModelFilter( true ); @@ -1018,6 +1018,8 @@ static void fgMainLoop( void ) { // static const SGPropertyNode *replay_master // = fgGetNode("/sim/freeze/replay", true); + SGCloudLayer::enable_bump_mapping = fgGetBool("/sim/rendering/bump-mapping",true); + // Update the elapsed time. static bool first_time = true; if ( first_time ) { @@ -1769,9 +1771,14 @@ bool fgMainInit( int argc, char **argv ) { // build our custom render states fgBuildRenderStates(); - - // pass control off to the master event handler - fgOSMainLoop(); + + try { + // pass control off to the master event handler + fgOSMainLoop(); + } catch (...) { + SG_LOG( SG_ALL, SG_ALERT, + "Unknown exception in the main loop. Aborting..." ); + } // we never actually get here ... but to avoid compiler warnings, // etc.