How to draw things manually without using smgr?

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
wsw1231
Posts: 148
Joined: Fri Oct 01, 2010 7:55 am

How to draw things manually without using smgr?

Post by wsw1231 »

In fact, my question starts from
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=42563

After searching other posts, what I need to do to make a node appear in front of other nodes is to draw it manually after smgr->drawAll();

However, I do not know how to do so.
Could someone please help me out?
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

Working on game: Marrbles (Currently stopped).
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

Yep, use

Code: Select all

node->render()
Just be sure to set the transformations before rendering. I think it was

Code: Select all

driver->setTransformation(ETS_WORLD,node->getAbsoluteTransformation())
Or something like that.
wsw1231
Posts: 148
Joined: Fri Oct 01, 2010 7:55 am

Post by wsw1231 »

Lonesome Ducky wrote:Yep, use

Code: Select all

node->render()
Just be sure to set the transformations before rendering. I think it was

Code: Select all

driver->setTransformation(ETS_WORLD,node->getAbsoluteTransformation())
Or something like that.
Thanks for reminding me of that API.

However, I have a question

If the cube node is rendered in smgr, we can use

Code: Select all

smgr->addCubeSceneNode();
So, if I render it manually, the above code cannot be used. Does it mean I need to set parameters such as size, scale.....etc. by myself to form a cube node?

Also, the main question is how can I instantiate this node?
I have tried

Code: Select all

ISceneNode* n = new ISceneNode();
But since ISceneNode is an abstract class, instantiating objects from this class is not allowed :(
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

I think irrlicht just isn't designed for actual manual rendering, the render() call on a scenenode will probably cause problems outside of a scene manager draw call, since render() will do a check for the scene manager's render pass

When the scene manager is not in a drawing state, render passes won't be updated and nodes which have called render() will not draw to the screen since the scene manager is not in the right render pass

And about direct node instancing, irrlicht does not expose the base scene node classes to the end user, only scene manager functions to create the nodes
This is done because of memory management (the scene manager can automatically drop any node it has created whenever the node is not needed anymore), and because of the nice hierarchical engine structure you get out of it
Anthony
Posts: 121
Joined: Sun Jan 09, 2011 12:03 pm

Post by Anthony »

As I believe you mean to get an answer to this question 'Translation and rotation', I posted it there.

Hope it's worth something.

However it is mabe considerable to create your own derived CSceneNode to render debugging info (or edit info).

Code: Select all

class IEditableSceneNode : public ISceneNode
{
// implement at least constructor and abstract methods
public:
const core::aabbox3d<f32>& getBoundingBox() const
{
  return _boundingBox;
};
virtual render()
{
// rendering stuff
}
private:
core::aabbox3d<f32> BoundingBox;
};
No :shock: I am no noob, just checking if your not one too :roll:

Thanks to Niko and all others that made Irrlicht possible.
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

To render all my nodes manually I had to add a function to the scene manager class 'setRenderPass' to set the current rendering pass so as to be able to render for exemple transparent nodes. I didn't find any other way to do it without recompiling the engine, using the basic nodes.
Post Reply