Make resolution change more robust

This commit is contained in:
Vincent Lejeune
2014-10-28 23:43:41 +01:00
parent cd74ee0d87
commit 40932fadeb
2 changed files with 12 additions and 5 deletions

View File

@@ -35,8 +35,10 @@
#include "graphics/stkanimatedmesh.hpp"
#include "graphics/stkbillboard.hpp"
#include "graphics/stkmeshscenenode.hpp"
#include "graphics/stkscenemanager.hpp"
#include "graphics/sun.hpp"
#include "graphics/rtts.hpp"
#include "graphics/texturemanager.hpp"
#include "graphics/water.hpp"
#include "graphics/wind.hpp"
#include "guiengine/engine.hpp"
@@ -804,6 +806,12 @@ void IrrDriver::applyResolutionSettings()
// That's just error prone
// (we're sure to update main.cpp at some point and forget this one...)
m_shaders->killShaders();
VAOManager::getInstance()->kill();
SolidPassCmd::getInstance()->kill();
ShadowPassCmd::getInstance()->kill();
RSMPassCmd::getInstance()->kill();
GlowPassCmd::getInstance()->kill();
resetTextureTable();
// initDevice will drop the current device.
initDevice();

View File

@@ -16,10 +16,13 @@ GLuint getDepthTexture(irr::video::ITexture *tex)
return static_cast<irr::video::COpenGLFBOTexture*>(tex)->DepthBufferTexture;
}
std::set<irr::video::ITexture *> AlreadyTransformedTexture;
static std::set<irr::video::ITexture *> AlreadyTransformedTexture;
static std::map<int, video::ITexture*> unicolor_cache;
void resetTextureTable()
{
AlreadyTransformedTexture.clear();
unicolor_cache.clear();
}
void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha)
@@ -167,10 +170,6 @@ void saveCompressedTexture(const std::string& compressed_tex)
delete[] data;
}
static unsigned colorcount = 0;
std::map<int, video::ITexture*> unicolor_cache;
video::ITexture* getUnicolorTexture(const video::SColor &c)
{
std::map<int, video::ITexture*>::iterator it = unicolor_cache.find(c.color);