diff --git a/src/Cockpit/panel.cxx b/src/Cockpit/panel.cxx index 09194ef12..8f34beac1 100644 --- a/src/Cockpit/panel.cxx +++ b/src/Cockpit/panel.cxx @@ -31,7 +31,6 @@ #include -#include #include #include diff --git a/src/GUI/gui_funcs.cxx b/src/GUI/gui_funcs.cxx index a4a30ee62..dc352b61b 100644 --- a/src/GUI/gui_funcs.cxx +++ b/src/GUI/gui_funcs.cxx @@ -532,15 +532,16 @@ void fgHiResDump() puHideCursor(); } - fgInitVisuals(); - fgReshape( fgGetInt("/sim/startup/xsize"), - fgGetInt("/sim/startup/ysize") ); + FGRenderer *rendrer = globals->get_renderer(); + renderer->init(); + renderer->resize( fgGetInt("/sim/startup/xsize"), + fgGetInt("/sim/startup/ysize") ); // we need two render frames here to clear the menu and cursor // ... not sure why but doing an extra fgRenderFrame() shouldn't // hurt anything - fgRenderFrame(); - fgRenderFrame(); + renderer->update( 0.0 ); + renderer->update( 0.0 ); // Make sure we have SSG projection primed for current view glMatrixMode(GL_MODELVIEW); diff --git a/src/Main/Makefile.am b/src/Main/Makefile.am index 9a3064fda..87fc984aa 100644 --- a/src/Main/Makefile.am +++ b/src/Main/Makefile.am @@ -37,6 +37,7 @@ noinst_LIBRARIES = libMain.a libMain_a_SOURCES = \ main.cxx main.hxx \ + renderer.cxx renderer.hxx \ fg_commands.cxx fg_commands.hxx \ fg_init.cxx fg_init.hxx \ fg_io.cxx fg_io.hxx \ diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index 73adb93ea..d8b2997c8 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -42,6 +42,7 @@ FGGlobals *globals; // Constructor FGGlobals::FGGlobals() : + renderer( new FGRenderer ), subsystem_mgr( new SGSubsystemMgr ), event_mgr( new SGEventMgr ), sim_time_sec( 0.0 ), @@ -95,6 +96,7 @@ FGGlobals::~FGGlobals() delete props; delete commands; delete io; + delete renderer; // make sure only to delete the initial waypoints list if it acually // still exists. @@ -157,6 +159,12 @@ void FGGlobals::set_fg_scenery (const string &scenery) { } +FGRenderer * +FGGlobals::get_renderer () const +{ + return renderer; +} + SGSubsystemMgr * FGGlobals::get_subsystem_mgr () const { diff --git a/src/Main/globals.hxx b/src/Main/globals.hxx index 3077e750e..13215e6ee 100644 --- a/src/Main/globals.hxx +++ b/src/Main/globals.hxx @@ -42,6 +42,8 @@ SG_USING_STD( string ); typedef vector string_list; +#include "renderer.hxx" + // Forward declarations // This file is included, directly or indirectly, almost everywhere in @@ -97,6 +99,7 @@ class FGGlobals private: + FGRenderer *renderer; SGSubsystemMgr *subsystem_mgr; SGEventMgr *event_mgr; @@ -217,6 +220,8 @@ public: FGGlobals(); virtual ~FGGlobals(); + virtual FGRenderer *get_renderer () const; + virtual SGSubsystemMgr *get_subsystem_mgr () const; virtual SGSubsystem *get_subsystem (const char * name); diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 0915f2d23..0085984ea 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -41,31 +41,23 @@ # include #endif -#include #include -#include -#include #include -#include #include -#include -#include -#include #include -#include -#ifdef FG_USE_CLOUDS_3D -# include -# include -#endif +// Class refferences +#include +#include +#include +#include +#include +#include