PDA

View Full Version : Loading textures at runtime without hiccups



Punchey
05-24-2003, 01:15 PM
I'm trying to find out what techniques other people out there are using to load their textures at runtime in their apps so as not to cause a "hiccup" in their animation. If you try to load a large texture (1024x1024 or more) or a group of textures while your animation is running, you'll see a noticable hiccup as your app has to pause to load the texture(s).

I've thought about loading the textures in a separate thread, but I simply cannot get this to work as OpenGL doesn't seem to want to share texture ID names across threads no matter what I do. Has anyone else out there had success with multiple threads for this?

Or does anyone have any other suggestions on ways to help reduce or eliminate the potential for "hiccups" caused by this?

Relic
05-27-2003, 07:36 AM
Sharing texture object's names is done with wglShareLists.
You might run into trouble when reusing texture object names which are bound in another thread for rendering.
If loading the full texture takes too long, maybe updating it in smaller stripes with glTexSubImage generates less load. (Not tried, might also be much slower.)
Use high texture priorities to define which textures are your current working set.
The ones which are uploaded on the fly should use a lower prio first. (No idea if any implementation cares today.)
If you're under very heavy load in your rendering thread any additional system and GPU load will get you hiccups. OS thread switching isn't for free either.