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

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
hzsyber
Posts: 52
Joined: Tue Apr 01, 2008 2:21 pm
Location: Canton,China.

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

Post 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?
hzsyber
Posts: 52
Joined: Tue Apr 01, 2008 2:21 pm
Location: Canton,China.

Post by hzsyber »

now, i know how to clear out gui menu :)
guienv->clear();

but i unknow how to 2dimage clear out scene :(
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Post by kornwaretm »

2D images? did you mean textures?
textures are managed by the IVideoDriver.
you don't need to wory about them.
hzsyber
Posts: 52
Joined: Tue Apr 01, 2008 2:21 pm
Location: Canton,China.

Post 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.
asphodeli
Posts: 36
Joined: Thu Jul 24, 2008 12:46 am
Location: Singapore

Post by asphodeli »

draw2DImage is driver-level rendering, and is not a GUI widget. Try using IGUIImage.
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Post by kornwaretm »

giuEnvironment->clear();
?.......................
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post 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
hzsyber
Posts: 52
Joined: Tue Apr 01, 2008 2:21 pm
Location: Canton,China.

Post by hzsyber »

thx all answer!
Post Reply