Hey Guys, I've just started working with irrlicht 2 days ago after finding it to be the engine which has the best easy to usefull ratio of the tons I saw on the net. I'm working my way through the tutorials, and there's one thing that I just can't get around my head (actually quite a lot, but I'll bother you with that later) and that's things like this:
selector = smgr->createTriangleSelector(node);
node->setTriangleSelector(selector);
selector->drop();
Why do we drop the function that is used to do something to a node before we have even used it on the node. What I'm seeing is that it's not a function as such, but more of a process of attaching an appendage to a node which it will keep for the rest of the main loop?
If I'm not being clear, just shout.
Thanks
Can the process of setting something be explained to me?
Re: Can the process of setting something be explained to me
You must do drop() for any create*() call you do.
In you particular example setTriangleSelector() will do grab() on selector arg (this way he states that he is going to use it and call drop() after all internally; for example when you do another setTriangleSelector() old selector will get drop() call and new one will get grab()). This is called "reference counting" as far as i know.
In you particular example setTriangleSelector() will do grab() on selector arg (this way he states that he is going to use it and call drop() after all internally; for example when you do another setTriangleSelector() old selector will get drop() call and new one will get grab()). This is called "reference counting" as far as i know.
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
Re: Can the process of setting something be explained to me
Yes, but the examples are stupid. You should drop things AFTER you are done with them, not right after initialization.
"Whoops..."
Re: Can the process of setting something be explained to me
Thanks for the quick replies.
I see it's doing all this stuff in the main loop, it creates, edits then drops again. I don't get why you can't create outside the loop, and only have a function call for the transformations, or updates or things. All these pointers are also confusing, but that's not bad, I have to learn to see in pointers.
I'm not used to working with an engine in this way, it feels very hands off, I never see any of the functions that actually make the thing tick, its all just references of references. But, that's why I chose this engine, it seems more down to earth than most.
I see it's doing all this stuff in the main loop, it creates, edits then drops again. I don't get why you can't create outside the loop, and only have a function call for the transformations, or updates or things. All these pointers are also confusing, but that's not bad, I have to learn to see in pointers.
I'm not used to working with an engine in this way, it feels very hands off, I never see any of the functions that actually make the thing tick, its all just references of references. But, that's why I chose this engine, it seems more down to earth than most.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: Can the process of setting something be explained to me
Triangle selectors shouldn't be created in the render loop, these are resources which can be created one. And the examples in the SDK should be updated to not drop things before their last use. Maybe not the first one, to make relations clear between create* and drop. But all others were updated some time ago.
Re: Can the process of setting something be explained to me
reference counting should take a tutorial separed from others. There's always someone asking about how to use reference counted stuff. Any idea to add a new example to SDK?
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me