Author Topic: Upload textures "manually"  (Read 1209 times)

Offline QuirB

  • byte
  • *
  • Posts: 7
    • View Profile
Upload textures "manually"
« on: August 13, 2014, 08:31:53 am »
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().

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11746
    • View Profile
    • http://www.jpct.net
Re: Upload textures "manually"
« Reply #1 on: August 13, 2014, 09:01:06 am »
No, not explicitly. You might want to load the textures in question first, do a call to prewarm and then load the rest.

Offline QuirB

  • byte
  • *
  • Posts: 7
    • View Profile
Re: Upload textures "manually"
« Reply #2 on: August 13, 2014, 08:52:44 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11746
    • View Profile
    • http://www.jpct.net
Re: Upload textures "manually"
« Reply #3 on: August 13, 2014, 11:32:37 pm »
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?

Offline QuirB

  • byte
  • *
  • Posts: 7
    • View Profile
Re: Upload textures "manually"
« Reply #4 on: August 20, 2014, 07:24:47 am »
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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11746
    • View Profile
    • http://www.jpct.net
Re: Upload textures "manually"
« Reply #5 on: August 20, 2014, 07:36:57 am »
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.

Offline QuirB

  • byte
  • *
  • Posts: 7
    • View Profile
Re: Upload textures "manually"
« Reply #6 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.

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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11746
    • View Profile
    • http://www.jpct.net
Re: Upload textures "manually"
« Reply #7 on: August 21, 2014, 08:37:44 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.
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.

Offline QuirB

  • byte
  • *
  • Posts: 7
    • View Profile
Re: Upload textures "manually"
« Reply #8 on: August 24, 2014, 02:05:55 pm »
I'm having trouble getting the Virtualizer to work.

My current steps are like this:
Code: [Select]
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11746
    • View Profile
    • http://www.jpct.net
Re: Upload textures "manually"
« Reply #9 on: August 24, 2014, 02:25:07 pm »
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.