diff --git a/src/Main/renderer.cxx b/src/Main/renderer.cxx index f3dd310c5..f6522af0a 100644 --- a/src/Main/renderer.cxx +++ b/src/Main/renderer.cxx @@ -153,6 +153,8 @@ public: glPopClientAttrib(); glPopAttrib(); + } else { + fgSplashExit(); } state.popStateSet(); diff --git a/src/Main/splash.cxx b/src/Main/splash.cxx index 608ab425a..761c14e5b 100644 --- a/src/Main/splash.cxx +++ b/src/Main/splash.cxx @@ -55,7 +55,7 @@ #include "renderer.hxx" static const char *progress_text = 0; -static SGTexture splash; +static SGTexture *splash = new SGTexture; SGPropertyNode_ptr style = 0; @@ -70,7 +70,7 @@ void fgSplashInit ( const char *splash_texture ) { if (!fgGetBool("/sim/startup/splash-screen")) return; - splash.bind(); + splash->bind(); SGPath tpath( globals->get_fg_root() ); if (splash_texture == NULL || !strcmp(splash_texture, "")) { @@ -85,15 +85,15 @@ void fgSplashInit ( const char *splash_texture ) { } else tpath.append( splash_texture ); - splash.read_rgba_texture(tpath.c_str()); - if (!splash.usable()) + splash->read_rgba_texture(tpath.c_str()); + if (!splash->usable()) { // Try compressed SGPath fg_tpath = tpath; fg_tpath.concat( ".gz" ); - splash.read_rgba_texture(fg_tpath.c_str()); - if ( !splash.usable() ) + splash->read_rgba_texture(fg_tpath.c_str()); + if ( !splash->usable() ) { SG_LOG( SG_GENERAL, SG_ALERT, "Error in loading splash screen texture " << tpath.str() ); @@ -101,7 +101,14 @@ void fgSplashInit ( const char *splash_texture ) { } } - splash.select(); + splash->select(); +} + + +void fgSplashExit () +{ + delete splash; + splash = 0; } @@ -167,7 +174,7 @@ void fgSplashUpdate ( float alpha ) { // now draw the logo if (fgGetBool("/sim/startup/splash-screen", true)) { glEnable(GL_TEXTURE_2D); - splash.bind(); + splash->bind(); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glColor4f( 1.0, 1.0, 1.0, alpha ); diff --git a/src/Main/splash.hxx b/src/Main/splash.hxx index e50c489e8..7ee57e856 100644 --- a/src/Main/splash.hxx +++ b/src/Main/splash.hxx @@ -38,7 +38,10 @@ void fgSplashInit ( const char *splash_texture ); void fgSplashUpdate ( float alpha ); // Set progress information -void fgSplashProgress( const char *text ); +void fgSplashProgress ( const char *text ); + +// Free texture memory +void fgSplashExit (); #endif // _SPLASH_HXX