Manually draw scene node

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
Darkcoder
Posts: 13
Joined: Fri Apr 02, 2010 7:15 am

Manually draw scene node

Post by Darkcoder »

In my current project I've come across a draw order issue, you can see it here: http://dl.dropbox.com/u/592301/whatIsThis.jpg

The issue is that the transparent glass is being drawn before the transparent background objects, so they inevitably fail the zdepth test. I'm aware that I can disable zwrite on the glass, or add some more nodes to my background objects to work around this issue, but I'd much rather just draw the background items before the foreground. So far, I've created a new scene node for all my background nodes to attach to, I've detached this node from the scene manager via the 'grab(); then remove()' trick, but simply calling render() on the node doesn't do anything. I also tried calling onRegisterSceneNode() but that just seems to add it to the scene manager's draw list, so is there some easy way to just render this node and all of its children before I hit drawAll()?
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

I had the same problem before and porcus helped me out : if you're trying to render a transparent node manualy you have to call :
driver->drawMeshBuffer(yourObject->getMesh(0)->getMeshBuffer(0))
instead of node->render().
Don't forget the: node->onAnimate() if you're rendering an animated object.
Darkcoder
Posts: 13
Joined: Fri Apr 02, 2010 7:15 am

Post by Darkcoder »

Interesting, though when I say node I meant that quite a lot of nodes attach to it. So this method would work if I called it on all the children, but surely there must be some way to just manually render a node and have all its descendants drawn too?
Post Reply