Page 1 of 1

Manually draw scene node

Posted: Fri Aug 13, 2010 4:26 am
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()?

Posted: Fri Aug 13, 2010 12:52 pm
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.

Posted: Fri Aug 13, 2010 5:45 pm
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?