smgr->clear() prevents smgr->loadScene() ??
smgr->clear() prevents smgr->loadScene() ??
I'm trying to clear my current scene and load a new one in straight away so i basically have the following:
smgr->clear();
smgr->loadScene(filename);
But this prevents the new scene actually being loaded... If i comment out clear() then the new scene loads fine (but of course the old scene is still present).
Has anyone come across this before? I checked the docs and it doesn't say i have to call any other functions in between or anything...
(i'm using 1.3.1 by the way)
smgr->clear();
smgr->loadScene(filename);
But this prevents the new scene actually being loaded... If i comment out clear() then the new scene loads fine (but of course the old scene is still present).
Has anyone come across this before? I checked the docs and it doesn't say i have to call any other functions in between or anything...
(i'm using 1.3.1 by the way)
-
rogerborg
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Maybe you need some kind of update in between?
eg:
smgr->clear();
device->run();
smgr->drawAll();
smgr->loadScene();
eg:
smgr->clear();
device->run();
smgr->drawAll();
smgr->loadScene();
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Well that didn't help at all...
I'm considering, as a temporary fix, creating a new smgr each time a new scene needs to be loaded and 'forcing' that to be treated as the main smgr (it's a shame you can't actually set the main smgr instead of having to pass on events to it, but i guess it's not too much extra work).
updating to 1.4 is definetly on my list of things to do but i don't particularly want to tackle that right now as it's not the simplest of jobs, as i found out last time i attempted the update
I'm considering, as a temporary fix, creating a new smgr each time a new scene needs to be loaded and 'forcing' that to be treated as the main smgr (it's a shame you can't actually set the main smgr instead of having to pass on events to it, but i guess it's not too much extra work).
updating to 1.4 is definetly on my list of things to do but i don't particularly want to tackle that right now as it's not the simplest of jobs, as i found out last time i attempted the update
That's weird.
I added this code:
To example 08.SpecialFX:
v1.4: After clear() I see the textures are loaded (in the console) but nothing on screen, black window.
SVN Revision 1354 (trunk): Same.
P.S
Then I guess you did found something JP..
I added this code:
Code: Select all
if(device->getTimer()->getTime() == 2000)
{
smgr->clear();
smgr->loadScene("../../media/example.irr");
}v1.4: After clear() I see the textures are loaded (in the console) but nothing on screen, black window.
SVN Revision 1354 (trunk): Same.
P.S
Code: Select all
while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, 0);
smgr->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str = L"Irrlicht Engine - SpecialFX example [";
str += driver->getName();
str += "] FPS:";
str += fps;
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
if(device->getTimer()->getTime() == 2000)
{
smgr->clear();
smgr->loadScene("../../media/example.irr");
}
}Which code did you use?rogerborg wrote:clear() then loadScene() Works For Me in the latest SVN version, at least with simple scenes.
Edit:
You say "at least with simple scenes", well, it happens with example.irr which is a very simple scene...
Last edited by MasterGod on Thu May 22, 2008 2:48 pm, edited 1 time in total.
-
rogerborg
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Example 01. I just put in a smgr->saveScene() before the main loop, ran it, then replaced it with a smgr->clear() and smgr->loadScene(), again before the main loop (with the return values checked). That said, I'm just assuming that what I'm seeing is the results of the loaded scene; it's possible that both the clear() and loadScene() failed.MasterGod wrote:Which code did you use?rogerborg wrote:clear() then loadScene() Works For Me in the latest SVN version, at least with simple scenes.
Edit:
You say "at least with simple scenes", well, it happens with example.irr which is a very simple scene...
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Are you certain that the problem isn't that the camera was wiped out and not re-created [or at least cached and re-inserted into the scene graph]?
The example.irr scene file doesn't have a camera in it, and most applications create a camera in the main loop, so you might run into problems if you don't setup a camera after clearing the scene.
Travis
The example.irr scene file doesn't have a camera in it, and most applications create a camera in the main loop, so you might run into problems if you don't setup a camera after clearing the scene.
Travis
You know what Vitek.... You might have cracked it there!
I completely forgot about the camera being part of the scene so smgr->clear() would remove it and it's not actually part of the scene that's loaded in so then the smgr just won't render anything!
I'll give that a go but i'm fairly sure that's the problem!
EDIT: Sorted, thanks very much Vitek, you get the gold star. Everyone else will have to make do with a sliver star... to share between you... you did good, but not quite good enough!
But seriously, thanks everyone who chipped in to help out! I really appreciate it!
I completely forgot about the camera being part of the scene so smgr->clear() would remove it and it's not actually part of the scene that's loaded in so then the smgr just won't render anything!
I'll give that a go but i'm fairly sure that's the problem!
EDIT: Sorted, thanks very much Vitek, you get the gold star. Everyone else will have to make do with a sliver star... to share between you... you did good, but not quite good enough!
But seriously, thanks everyone who chipped in to help out! I really appreciate it!

