I’ve created an OpenGL application which loads various resources (model files, image files, map files).
All these resources are loaded in the init section of the application.
When I start the application it hangs while all the resources are loaded.
What I want to know is how do I display a loading output while everything is being loaded. It doesn’t need to be complex like status bars, just a screen outputting “loading” rather than a hanging terminal window.
advanced or not, i would recommend (under windows) to build your app with a console window and use print() function to display there anything you want.
I would have the open window with an OpenGL context running on one thread, and load the resources on a separate one. That way, you can change some progress variable, and redraw the loading bar while loading the resources.
forget threads youre overcomplicating it, for what benifit?
I do this
create dummy opengl window / query stuff
load a plaintexture glsl shader
load a startup screen texture
draw this on a quad
swapbuffer
current time since program startup is 300 msec (which feels instantaneous before the startscreen is showing, though u could do quicker if u wanted to no doubt)
… load all the other resources … textures/shaders/models etc
This may sound overly complicated, but if you trying to make a project or game that has to load a signifigant amount of resources and results in a 5+ secs of loading, then this is how it’s done.
What quality game presents a static quad for 20 seconds while it loads? It’s not hard to set up one threaded load function.