PDA

View Full Version : Loading screen



peted
01-26-2009, 06:01 PM
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.

Any suggestions, best ways to do this?

Thanks,
Pete

satan
01-26-2009, 07:08 PM
Sorry, this question is too advanced for me. Perhaps you better post in the highly advanced forum.

Simon Arbon
01-26-2009, 08:19 PM
in windows:
1/ call CreateWindowEx and ensure WS_VISIBLE style is set for the 'Loading' window.
2/ call UpdateWindow( WindowHandle )
3/ load resources

_NK47
01-27-2009, 03:48 AM
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.

print("loading resources from directory");

satan
01-27-2009, 06:36 AM
i would recommend (under windows) to build your app with a console window and use print() function to display there anything you want.

print("loading resources from directory");
This is ugly. Why not create context, draw some nice OpenGL stuff and then load all the resources?

todayman
01-27-2009, 09:38 AM
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.

peted
01-27-2009, 01:13 PM
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.

Is using threads complicated?

zed
01-27-2009, 07:01 PM
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

PatriotBob
02-02-2009, 12:44 PM
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.

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.