Texture manager (always ready texture objects)


I would like some hint on how to pre-fetch texture objects. In my application i have a lot of 3D textures, so many that often the amount of texture is exceeding the size of the available texture(/graphics) memory. The 3D textures are “frames” in an animation that runs in a loop. If there is too little texture memory to hold all textures the performance drops because OpenGL swaps texture objects to main memory and there is a delay when OpenGL fetches them back for display. I guess OpenGL uses a least-recently-used algorithm to decide which texture object to swap to main memory. The problem is that this texture is then needed in the next run of the animation and has to be fetched back in.

What I like to know is if there are a way to specify for OpenGL that in, say 5 frames, I would need this texture object to be in texture memory. I know that I can set priority to the texture objects, but I do not think that this can help me pre-fetch texture objects.

Sub sampling the texture is not an option b/c I need full texture resolution.

I have tried to search for a solution to this problem, but I cannot find any. I hope someone can give me a hint if this is possible.

Hi endrelidal,

your problem is very interesting for me, too. I am also using 3d textures (for volume rendering) and it would be very useful to have some texture prefetch possibility.

What about glPrioritizeTextures? Did anybody have success using it and how should I use it?
(on nvidia hardware)

It would also be interesting to know what paging strategies are used for textures.