Fix totally messed up 3d modes interlaced/topbottom/sidebyside

This commit is contained in:
sapier 2014-09-25 20:33:17 +02:00
parent 15c7460eda
commit 121e8cc2a1
1 changed files with 11 additions and 7 deletions

View File

@ -132,14 +132,15 @@ void draw_anaglyph_3d_mode(Camera& camera, bool show_hud, Hud& hud,
}
void init_texture(video::IVideoDriver* driver, const v2u32& screensize,
video::ITexture** texture)
video::ITexture** texture, const char* name)
{
if (*texture != NULL)
{
driver->removeTexture(*texture);
}
*texture = driver->addRenderTargetTexture(
core::dimension2d<u32>(screensize.X, screensize.Y));
core::dimension2d<u32>(screensize.X, screensize.Y), name,
irr::video::ECF_A8R8G8B8);
}
video::ITexture* draw_image(const v2u32& screensize,
@ -156,13 +157,16 @@ video::ITexture* draw_image(const v2u32& screensize,
video::ITexture* image = NULL;
if (screensize != last_screensize) {
init_texture(driver, screensize, &images[1]);
image = images[1];
init_texture(driver, screensize, &images[0]);
image = images[0];
init_texture(driver, screensize, &images[1], "mt_drawimage_img1");
init_texture(driver, screensize, &images[0], "mt_drawimage_img2");
last_screensize = screensize;
}
if (psign == RIGHT)
image = images[1];
else
image = images[0];
driver->setRenderTarget(image, true, true,
irr::video::SColor(255,
skycolor.getRed(), skycolor.getGreen(), skycolor.getBlue()));
@ -205,7 +209,7 @@ video::ITexture* draw_hud(video::IVideoDriver* driver, const v2u32& screensize,
video::SColor skycolor, gui::IGUIEnvironment* guienv, Camera& camera )
{
static video::ITexture* image = NULL;
init_texture(driver, screensize, &image);
init_texture(driver, screensize, &image, "mt_drawimage_hud");
driver->setRenderTarget(image, true, true,
irr::video::SColor(255,0,0,0));