Restore max texture size when reloading skin.

Fixes #3111
This commit is contained in:
Deve 2018-06-05 23:55:31 +02:00
parent 5da5a1972f
commit 5e798ad6d4
3 changed files with 13 additions and 0 deletions

View File

@ -740,6 +740,13 @@ void IrrDriver::setMaxTextureSize()
att.setAttribute("MAX_TEXTURE_SIZE", core::dimension2du(max, max));
} // setMaxTextureSize
// ----------------------------------------------------------------------------
void IrrDriver::unsetMaxTextureSize()
{
io::IAttributes &att = m_video_driver->getNonConstDriverAttributes();
att.setAttribute("MAX_TEXTURE_SIZE", core::dimension2du(2048, 2048));
} // unsetMaxTextureSize
// ----------------------------------------------------------------------------
void IrrDriver::cleanSunInterposer()
{

View File

@ -197,6 +197,7 @@ public:
void initDevice();
void reset();
void setMaxTextureSize();
void unsetMaxTextureSize();
void getOpenGLData(std::string *vendor, std::string *renderer,
std::string *version);

View File

@ -26,6 +26,7 @@
#include "font/bold_face.hpp"
#include "font/font_manager.hpp"
#include "font/regular_face.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp"
#include "guiengine/widgets/button_widget.hpp"
@ -190,7 +191,9 @@ void OptionsScreenUI::init()
Log::warn("OptionsScreenUI",
"Couldn't find current skin in the list of skins!");
skinSelector->setValue(0);
irr_driver->unsetMaxTextureSize();
GUIEngine::reloadSkin();
irr_driver->setMaxTextureSize();
}
// --- language
@ -265,7 +268,9 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
const core::stringw selectedSkin = skinSelector->getStringValue();
UserConfigParams::m_skin_file = core::stringc(selectedSkin.c_str()).c_str() + std::string(".stkskin");
irr_driver->unsetMaxTextureSize();
GUIEngine::reloadSkin();
irr_driver->setMaxTextureSize();
}
else if (name == "split_screen_horizontally")
{