Fix only one texture being updated on window resize breaking sidebyside and topbottom 3d modes

This commit is contained in:
sapier 2014-08-29 01:35:35 +02:00
parent fb2183b61d
commit e5b4748bb4
1 changed files with 7 additions and 13 deletions

View File

@ -130,10 +130,6 @@ void draw_anaglyph_3d_mode(Camera& camera, bool show_hud, Hud& hud,
void init_texture(video::IVideoDriver* driver, const v2u32& screensize, void init_texture(video::IVideoDriver* driver, const v2u32& screensize,
video::ITexture** texture) video::ITexture** texture)
{
static v2u32 last_screensize = v2u32(0,0);
if (( *texture == NULL ) || (screensize != last_screensize))
{ {
if (*texture != NULL) if (*texture != NULL)
{ {
@ -141,8 +137,6 @@ void init_texture(video::IVideoDriver* driver, const v2u32& screensize,
} }
*texture = driver->addRenderTargetTexture( *texture = driver->addRenderTargetTexture(
core::dimension2d<u32>(screensize.X, screensize.Y)); core::dimension2d<u32>(screensize.X, screensize.Y));
last_screensize = screensize;
}
} }
video::ITexture* draw_image(const v2u32& screensize, video::ITexture* draw_image(const v2u32& screensize,
@ -154,16 +148,16 @@ video::ITexture* draw_image(const v2u32& screensize,
video::SColor skycolor ) video::SColor skycolor )
{ {
static video::ITexture* images[2] = { NULL, NULL }; static video::ITexture* images[2] = { NULL, NULL };
static v2u32 last_screensize = v2u32(0,0);
video::ITexture* image = NULL; video::ITexture* image = NULL;
if (psign == RIGHT) if (screensize != last_screensize) {
{
init_texture(driver, screensize, &images[1]); init_texture(driver, screensize, &images[1]);
image = images[1]; image = images[1];
} else {
init_texture(driver, screensize, &images[0]); init_texture(driver, screensize, &images[0]);
image = images[0]; image = images[0];
last_screensize = screensize;
} }
driver->setRenderTarget(image, true, true, driver->setRenderTarget(image, true, true,