Background <-> Foreground?

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
Listing
Posts: 12
Joined: Wed Jan 28, 2009 9:30 am

Background <-> Foreground?

Post by Listing »

I am trying to draw a 2d-Menu over my 3d-Game.

Unfortunately the 3d-Part always overlays the 2d-Textures....

It doesn't matter if I write

Code: Select all

Instance->smgr->drawAll();
	Instance->guienv->drawAll();
or vice versa

The code looks something like this:

Code: Select all

//2d Part
driver->draw2DRectangle(...);
The 3d part is automatically drawn because it is an animated mesh node

Thanks for your help
Kalango
Posts: 157
Joined: Thu Apr 26, 2007 12:46 am

Post by Kalango »

You should try to put the 3d drawing method before the guienv->drawAll();, because since its different components, and since 2d has no depht values, the engine follows the draw-first philosofy.
If you cant, you could try to render your 2d to a texture and place it in a 3d plane in front of your screen... thats the hard way to do it....
Nox
Posts: 304
Joined: Wed Jan 14, 2009 6:23 pm

Re: Background <-> Foreground?

Post by Nox »

Listing wrote:It doesn't matter if I write

Code: Select all

Instance->smgr->drawAll();
	Instance->guienv->drawAll();
or vice versa
hmm thats strange, because it should matter afaik. What settings do you use?
Listing
Posts: 12
Joined: Wed Jan 28, 2009 9:30 am

Post by Listing »

It works like Kalango said

I have to first issue "Instance->smgr->drawAll(); " and then do all the 2d-drawing stuff.

Annoying but ok...
Nox
Posts: 304
Joined: Wed Jan 14, 2009 6:23 pm

Post by Nox »

Well. Thats what is excepted from the engine ;). A 2D element which can not be overdrawn would be more annoying, because maybe there are some situations overdrawing a 2D element by a 3D object can be useful.
Post Reply