Upload textures "manually"

Started by QuirB, August 13, 2014, 08:31:53 AM

Previous topic - Next topic

QuirB

I' ve got a short question:

Is it possible to trigger the texture upload process for a specific texture manually?
I don't want to upload all the textures at once via prewarm().

EgonOlsen

No, not explicitly. You might want to load the textures in question first, do a call to prewarm and then load the rest.

QuirB

Thx for the fast answer. Is there a way to determine the progress of the prewarming process?
I'd like to load a bunch of textures but let the user know the app is still doing something.

EgonOlsen

No, there's not. And i don't see the point in this case, because the uploading shouldn't take very long anyway. How large are your texture, so that time is an issue here?

QuirB

I did some investigation on the issue.
Some of our Textures are quite large 2048*2048 for high-end devices.
The problem seems to be, that texture compression is done when the texture is uploaded to the gpu.

Can i trigger texture compression manually or even better directly load etc1 compressed textures from assets to the TextureManager?

EgonOlsen

No, but you can enable http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Config.html#cacheCompressedTextures and assign a Virtualizer (the docs for the config setting mention a TextureVirtualizer, which is wrong. I'll fix that...) to the TextureManager.

QuirB

As far as i understand, that won't help me reduce start-up times, since the virtualizer isn't able to reuse existing data from the disk when you created a new instance.

Is there any chance, we get support for directly feeding compressed textures into the TextureManager or something like that in the near future?

EgonOlsen

Quote from: QuirB on August 21, 2014, 08:06:12 AM
As far as i understand, that won't help me reduce start-up times, since the virtualizer isn't able to reuse existing data from the disk when you created a new instance.
No, that's not what it does in this case. It keeps the etc compressed textures cached even if the app terminates. It doesn't help for the first run, but all following runs will be faster unless you modify one of the textures again.
Quote from: QuirB on August 21, 2014, 08:06:12 AM
Is there any chance, we get support for directly feeding compressed textures into the TextureManager or something like that in the near future?
Not very likely. I looked into this topic some time ago and something prevented me from adding it. I just can't remember what it was, but it must have been a show stopper for some reason or otherwise i would have added it already.

QuirB

I'm having trouble getting the Virtualizer to work.

My current steps are like this:

Config.cacheCompressedTextures = true;

Virtualizer virtualizer = new Virtualizer();
virtualizer.setContext(context);

TextureManager tm = TextureManager.getInstance();
tm.setVirtualizer(virtualizer);

// For each texture
if (!tm.containsTexture(textureIdentifier))
// Load Texture and add it to texture manager


Do i have to call virtualize for each texture? I only want to virtualize the compressed textures for faster loading times.
Everytime I restart the game the virtualizer seems to be empty.

EgonOlsen

No, for caching compressed textures, all you have to do is to assign the Virtualizer to the TextureManager and set this config setting to true. You should see in the log output that it is in use.