how is it possible to do a loadscreen animation during the getMesh Process.
I only have one big mesh and I want to display a loadinganimation (think the best way is to work with a timer) during the texture loads.
If I put the smgr->getMesh Call in a While loop it will stuck on that call until the whole thing is loaded, so I only may display a frozen picture.
Im not an expert in programming, so perhaps you have some ideas how to do a loading screen with a small animation during the getMesh Process
loadingscreen during smgr->getMesh
Doing an actual animation during loading is pretty hard.. I've tried personally in raw OpenGL and never managed to get it perfect as you need multi-threading (a loading thread and a rendering thread) but things like texture loading are not thread safe so you get some strange behaviour going on like textures being overwritten.
It's easy to just do a loading bar showing how far through loading the application is. Something like this:
What updateProgress() does is to draw to the backbuffer a progress bar, as defined by the renderProgBar() function you'd implement yourself and then switch the buffers to put it on the screen. It then stays on the screen until the next call to updateProgress() which will then update the screen with the next amount of progress made.
It's easy to just do a loading bar showing how far through loading the application is. Something like this:
Code: Select all
void updateProgress(int prog) {
device->run(); // This may or not be necessary, not sure
driver->beginScene();
renderProgBar(prog);
driver->endScene();
}
int main() {
// Setup irrlicht
// Start loading stuff:
loadMesh1();
updateProgress(50);
loadMesh2();
updateProgress(100);
// Finished loading, now render whatever you were loading
while (device->run()) {
//render
}
}
thanks for the answer. The problem is that I have only one big mesh. I think the loadingbar thing only makes sense with more meshes cause you have to put the drawing calls inbetween the several mesh loadings.
think the problem with the one big mesh is that its only possible to display an animation in a seperate loop with multithreading like you said.
Is it perhaps possible to load a avi file before the smgr->getmesh call or something
think the problem with the one big mesh is that its only possible to display an animation in a seperate loop with multithreading like you said.
Is it perhaps possible to load a avi file before the smgr->getmesh call or something
-
- Posts: 914
- Joined: Fri Aug 03, 2007 12:43 pm
- Location: South Africa
- Contact:
my suggestion is create a animated sprite (there is one on the forums that works really well and is so easy)
That way, the animation can run off the time. And possible to load a mesh (ill try got to a example its just time is pushing this weekend.The other option is to break down your mesh into textures and stuff, or to make your own weird callback inside the mesh loader.
load texture1
load texture2
load texture3
load texture4
load texture5
apply model texture (texture1)
apply model texture (texture2)
apply model texture (texture3)
apply model texture (texture4)
apply model texture (texture5)
that breaks it into piecces to show a progress bar. The other option, multithreading :>?
That way, the animation can run off the time. And possible to load a mesh (ill try got to a example its just time is pushing this weekend.The other option is to break down your mesh into textures and stuff, or to make your own weird callback inside the mesh loader.
load texture1
load texture2
load texture3
load texture4
load texture5
apply model texture (texture1)
apply model texture (texture2)
apply model texture (texture3)
apply model texture (texture4)
apply model texture (texture5)
that breaks it into piecces to show a progress bar. The other option, multithreading :>?
could you get a little bit more detailed about the animated sprite thing?
how do I make a animated sprite? Think a Loadingbar with about 10 images would be enough. How do I get a animated sprite out of it?
with the well working thing on the forum I think you mean the animatedsprite-class from arras, right? How do I load my animated sprite when I have one?
sorry bout the stupid questions, never did something like that before
how do I make a animated sprite? Think a Loadingbar with about 10 images would be enough. How do I get a animated sprite out of it?
with the well working thing on the forum I think you mean the animatedsprite-class from arras, right? How do I load my animated sprite when I have one?
sorry bout the stupid questions, never did something like that before
Animated sprite thing won't work. Like JP said you can't draw the scene and load a texture at the same time.
Best option is the wierd callback route- copy and edit the mesh loader, make it pause during loading at regular intervals, and call your program to update the loading bar. You then use your modfied mesh loader to load the mesh instead of using smgr->getMesh
Best option is the wierd callback route- copy and edit the mesh loader, make it pause during loading at regular intervals, and call your program to update the loading bar. You then use your modfied mesh loader to load the mesh instead of using smgr->getMesh