A sceneode that is always on top

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
scriptr
Posts: 16
Joined: Wed Aug 12, 2009 12:14 pm

A sceneode that is always on top

Post by scriptr »

Hi,

I want add a scenenode and, want it to always render on top of the other scene nodes whereever the camera looks from, even the scenenode is at the back in 3d space. Is this possible?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, just call the render method explicitly in the render loop, instead of letting drawAll do the job.
Steel Style
Posts: 168
Joined: Sun Feb 04, 2007 3:30 pm
Location: France

Post by Steel Style »

Or you might need to render your scene node after the drawAll() clearing Zbuffer after the method.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Oh, sorry, forgot that. You can disable the zbuffer in the material, which makes the zclear unnecessary. You can also use a second scene manager, which makes it easier if you have more than once scene node to render on top.
scriptr
Posts: 16
Joined: Wed Aug 12, 2009 12:14 pm

Post by scriptr »

thank you very much, works perfect! :)

Code: Select all

_driver->beginScene(true, true, 0);
_smgr->drawAll();
		
_driver->clearZBuffer(); 
transformationArrows->render(); //Render always on top
	  
_driver->endScene();
Adversus
Posts: 128
Joined: Sun Oct 05, 2008 10:58 pm
Contact:

Post by Adversus »

Does this not mean it will be drawn twice.

Once in the drawAll and once manually.

You could setVisible to false first although a better solution might be wise i.e. a new E_SCENE_NODE_RENDER_PASS for drawAll().

I need to do this myself and I think that's how I'm going to do it although I don't really like to make changes to irrlicht as it makes upgrading more difficult.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Adversus wrote:Does this not mean it will be drawn twice.

Once in the drawAll and once manually.
If it's in the scene graph then yes, but you could grab() and then remove() the node, which will cause it to be removed from the scene graph but not destroyed (remember to drop() it later).

Using another scene manager would be the best way. No need to edit the source and no restrictions on the types of materials you can draw.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply