How to Force the Windows to Redraw

Hello everyone. I am new to Panda3D and have started my first project. I am trying to make a loading screen that shows a progress bar indicating how many of the game assets have been loaded, but when I run it the window remains black until after the first resource has been loaded and turns grey after the second one has been loaded. Is there a way to force the window to redraw after each time I update my progress bar?

My project is open-source and hosted on GitHub if you need to take a look at it:

When you load your assets, are you loading them asynchronously, or otherwise in a thread?

If not, then I imagine that the problem is that the program is effectively stopped by the loading of assets, waiting for the loading-commands to finish before going on to the next line. As a result, there’s no apparent opportunity for the window to update.

As suggested above, one solution to this is to load your assets in an asynchronous manner, occupying a separate thread or process, thus allowing your main program to continue to update the UI.

See here for more information:

I was using a task to load one resource per frame during the loading phase. However, it appears that I can just load them asynchronously in the background more efficiently. The original game I am porting had a loading screen because Ogre loads resources synchronously I guess.

Thanks for your help. :slight_smile:

1 Like
  1. You can call in a loop
  2. Or use the task manager.(I guess that’s what you’ve come to.)
    demo - Methods of level loading in Panda3d (Solved)

Thanks for the advice. I was looking for a way to render a frame immediately like that. :slight_smile: