Page 1 of 1

how to clear out all 2d gui&menu into 3d game?

Posted: Fri Sep 19, 2008 3:00 am
by hzsyber
...
ui2dimg = driver -> getTexture(texturefile.c_str());
...
while(device -> run() && driver)
{
...
if (gset->isUI)
driver -> draw2DImage(ui2dimg, position2d<int>(0, 0));
...
}


b4 into game,i use

device->getVideoDriver()->removeTexture(ui2dimg);

but scene always show 2dui & menu.

how to clear out all 2d texture & menu gui?

Posted: Fri Sep 19, 2008 3:17 am
by hzsyber
now, i know how to clear out gui menu :)
guienv->clear();

but i unknow how to 2dimage clear out scene :(

Posted: Fri Sep 19, 2008 3:27 am
by kornwaretm
2D images? did you mean textures?
textures are managed by the IVideoDriver.
you don't need to wory about them.

Posted: Fri Sep 19, 2008 4:16 am
by hzsyber
ui2dimg is ITexture*

maybe i can't clear deliver oneself of idea.

the 2d picture is menu's background.

when i choose some game, i need clear out currently all background & menu.
i use device->getVideoDriver()->removeTexture(ui2dimg); remove 2dimg,but,scene always show the 2d background.

Posted: Fri Sep 19, 2008 4:52 am
by asphodeli
draw2DImage is driver-level rendering, and is not a GUI widget. Try using IGUIImage.

Posted: Fri Sep 19, 2008 8:31 am
by kornwaretm
giuEnvironment->clear();
?.......................

Posted: Sat Sep 20, 2008 3:32 am
by vitek
If you don't want to draw ui2dimg, you need to avoid calling driver->draw2DImage(ui2dimg, ...). The easy way would be to write something like this...

Code: Select all

if (ui2dimg)
  driver->draw2DImage(ui2dimg, position2di(0, 0));
Instead of removing the texture from the texture cache, you would write this...

Code: Select all

//device->getVideoDriver()->removeTexture();
ui2dimg = 0;
Even easier would be to use an IImage.

Travis

Posted: Sun Sep 21, 2008 2:46 pm
by hzsyber
thx all answer!