Re: [GD-General] worker threads, level loading and progress bars
Brought to you by:
vexxed72
From: <cas...@ya...> - 2002-08-07 15:57:39
|
Well, thanks for all the input. I'll finally stick with the threaded mechanism, with the loader thread loading the textures into memory, and the main thread uploading them to vram. The thing I like about this approach is that it can be extended with ease to load resources during the game without too much interruption. I still have a few calls to the progress bar in the worker thread, to update the progress position, but it's interpolated nicely in the main thread. My worker thread has a higher priority than the main thread, (above_normal in win2k and highest in win9x). So that it doesn't take only 50% of the loading time. This seems to work ok, but will probably also add some signals, to ensure that the worker thread doesn't take all the time. Ignacio Castaño cas...@ya... > Thatcher Ulrich <tu...@tu...> wrote: > > I took a stab at this (loading in a background thread) in Soul Ride. > > In Win32, it's pretty easy to set up a new OpenGL render context, and > > use wglShareLists() so that textures defined in one thread are usable > > in the other thread. > > > > In captivity it worked, pretty well in fact. But at the time > > (early/mid 2000, IIRC) it was highly vulnerable to bugs in driver > > thread support, so I gave up and fell back on the DoWork() pattern. > > > > Under X, there seems to be a way to share textures across threads, but > > I never got around to trying it. Nowadays I try to use SDL for all > > video setup & config, and it does not have a facility like > > wglShareLists :( > > > > The worker queue thing works as well; my Chunked LOD demo uses this > > pattern -- I load the image data in the loader thread, and bind it in > > the foreground thread. But it still means some extra, unnecessary > > work for the foreground thread; plus the coding work. > > > > -Thatcher > > > > On Aug 07, 2002 at 04:44 +0200, Ignacio Casta?o wrote: > >> Hmm... it seems to my now, that the problem with the multiple > >> threads could be easily solved. > >> > >> The only OpenGL operation performed by the worker thread is to upload > >> textures, so my texture manager could have a list of textures > >> waiting to be uploaded, and I could process them on each game loop. > >> > >> Anyway, I still would like to hear how others have solve this > >> problem. > >> > >> _______________________________________________________________ Yahoo! Messenger Nueva versión: Webcam, voz, y mucho más ¡Gratis! Descárgalo ya desde http://messenger.yahoo.es |