Code not working, please help !
Code not working, please help !
After finding out that showing an animation during the loading process is really complicated I decided to do a static loading screen. But even this is not working
I try to draw the Image only during the loading process and I think therefore I need a Begin and EndScene Command.
Loop for the picture during the loadingprocess looks like this:
do{
driver->beginScene(true, true, 0);
driver->draw2DImage(driver->getTexture "../00.HdM/Hintergrund2.jpg"),
core::position2d<s32>(0,0));
driver->endScene();
//driver->clearZBuffer();
} while (mesh = smgr->getMesh("../00.HdM/mesh.my3d")->getMesh(0));
After the loading Process the Titlescreen should change to the main loop where the main scene is drawn. I also need Begin and EndScene here.
while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, 0);
smgr->drawAll();
driver->endScene();
}
how may I handle this? Dont know how to do this withous 2 Begin and EndScene Commands. If I do it like this either the picture is drawn and it doesnt go through to the main scene or the picture is not drawn but the scene instead.
Please help
I try to draw the Image only during the loading process and I think therefore I need a Begin and EndScene Command.
Loop for the picture during the loadingprocess looks like this:
do{
driver->beginScene(true, true, 0);
driver->draw2DImage(driver->getTexture "../00.HdM/Hintergrund2.jpg"),
core::position2d<s32>(0,0));
driver->endScene();
//driver->clearZBuffer();
} while (mesh = smgr->getMesh("../00.HdM/mesh.my3d")->getMesh(0));
After the loading Process the Titlescreen should change to the main loop where the main scene is drawn. I also need Begin and EndScene here.
while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, 0);
smgr->drawAll();
driver->endScene();
}
how may I handle this? Dont know how to do this withous 2 Begin and EndScene Commands. If I do it like this either the picture is drawn and it doesnt go through to the main scene or the picture is not drawn but the scene instead.
Please help
Re: Code not working, please help !
What the HELL is that??mark01 wrote: do{
driver->beginScene(true, true, 0);
driver->draw2DImage(driver->getTexture "../00.HdM/Hintergrund2.jpg"),
core::position2d<s32>(0,0));
driver->endScene();
//driver->clearZBuffer();
} while (mesh = smgr->getMesh("../00.HdM/mesh.my3d")->getMesh(0));
Sure the code within the loop is right but you don't want a loop there and the statement within the while statement is completely wrong for what you want and will NOT loop whilst the mesh is being loaded anyhow.
I've posted how to do a progress bar in another thread last night, it may have even been for you, so just do what i did there!
-
- Posts: 914
- Joined: Fri Aug 03, 2007 12:43 pm
- Location: South Africa
- Contact:
I know the drawing calls, but dont know where to put it to get the loadingscreen only during smgr-getmesh()
with guienv->addImage I dont get a result at all.
Only a blank screen.
With draw2dimage I got a result but dont no where to put it because it should be only during the texture loading
please help
with guienv->addImage I dont get a result at all.
Only a blank screen.
With draw2dimage I got a result but dont no where to put it because it should be only during the texture loading
please help
you will probably need two while loopers, one for showing the loading screen and the other one the scene itself.
in the first loop, you can load a very small scene with a one or two textures, probably add a sound node just for fun.
before you enter the first loop, setup the code for loading the second scene. then check for isloaded() and then break out of the first and enter the second one when loading is done.
in the first loop, you can load a very small scene with a one or two textures, probably add a sound node just for fun.
before you enter the first loop, setup the code for loading the second scene. then check for isloaded() and then break out of the first and enter the second one when loading is done.
Code: Select all
mesh = smgr->getMesh("../00.HdM/mesh.my3d")->getMesh(0);
do{
driver->beginScene(true, true, 0);
driver->draw2DImage(driver->getTexture "../00.HdM/Hintergrund2.jpg"),
core::position2d<s32>(0,0));
driver->endScene();
//driver->clearZBuffer();
g_isloaded = mesh->something_that_returns_is_loaded();
} while ( !g_isloaded ) ;
otherwise, let's think of another way.
Why loop at all? Just call the draw and then load. The reason that you usually have a loop around that stuff is that you want to change the screen 60 times per second (or whatever your FPS). As long as it's not changing you don't need to redraw it all the time.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
I think it stucks during the smgr-getmesh call.
Im also not sure if a loop is needed because after loading with smgr->getmesh it would maybe be enough to erase the picture. But dont know how this is done.
Like said before the GUIEnvironment call dont work so I cant use the image->remove thing.
Also I dont know if its possible to do Begin - EndScende twice, perhaps the error lies within this issue
all I know is that when doing the thing like above without the while loop is that it stucks on the loading screen
Im also not sure if a loop is needed because after loading with smgr->getmesh it would maybe be enough to erase the picture. But dont know how this is done.
Like said before the GUIEnvironment call dont work so I cant use the image->remove thing.
Also I dont know if its possible to do Begin - EndScende twice, perhaps the error lies within this issue
all I know is that when doing the thing like above without the while loop is that it stucks on the loading screen
Sure it's stuck. You wrote a do while loop which runs as long as smgr->getMesh returns a true result. So it loads - returns true - starts loading again - returns true - start loading... (well, it will actually take it from the cache after the first time, but still - it will just continue doing so infinitely)mark01 wrote: all I know is that when doing the thing like above without the while loop is that it stucks on the loading screen
Did you try to just remove the do-while? If I don't miss something here, then it's just not needed.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
lol......just do:
That will show the loading screen.
Code: Select all
driver->beginScene(true, true, 0);
driver->draw2DImage(driver->getTexture "../00.HdM/Hintergrund2.jpg"),
core::position2d<s32>(0,0));
driver->endScene();
mesh = smgr->getMesh("../00.HdM/mesh.my3d")->getMesh(0);
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.