To set a scene node above one 2D GUI element

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
winny8674
Posts: 4
Joined: Fri Feb 22, 2008 11:54 am

To set a scene node above one 2D GUI element

Post by winny8674 »

I want to know if there are any method to achieve this.

As I am making a game which I plan to have half of the screen in a 3D world with some characters, and another half of the screen covered by an 2D image. Furthermore, there are one character appearing on (above) the 2D image.

What I am now making is to make the 2D image into an IGUIImage, but I don't know if there are ways that I can put my character(animated scene node) above the IGUIImage?

Can any one tell me what I should do with it, or any suggestion that I can have the same effect?
Gianni
Posts: 48
Joined: Sat Mar 22, 2008 9:24 am

Post by Gianni »

i think, but i don't secure, you might reduce the visibility of gui.

Io penso, ma non ne sono sicuro, che potresti diminuire la visibilità delle gui.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

If I'm understanding you correctly, you are trying to create a window that has a background and then shows a mesh in the foreground. Irrlicht has the IGUIMeshViewer that you should be able to use. A while back the mesh viewer element didn't work, so I wrote CGUIViewport that you could use to render an entire scene inside a gui element.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

scene and gui are rendered in order you specify. This for example will render scene first than gui (means gui elements will always be rendered on top of scene elements):

Code: Select all

while(device->run())
   {
      driver->beginScene(true, true, video::SColor(0,200,200,200));

      smgr->drawAll();
      guienv->drawAll();

      driver->endScene();
   }
If you wan, you can render it in opposite order.
If you however want to draw just one specific gui element before all else, you have to draw it manually yourself. Unfortunately there is no way you can create CGUIImage so you have to draw image yourself. Something like this should work:

Code: Select all

video::ITexture *image = driver->getTexture("free.bmp");

   while(device->run())
   {
      driver->beginScene(true, true, video::SColor(0,200,200,200));

      driver->draw2DImage(image, core::position2d<s32>(50,50));
      smgr->drawAll();
      guienv->drawAll();

      driver->endScene();
   }
Post Reply