Hi,
Im starting using jME and i havent found what is the right way to use TextureManager to ensure that an image file wont be loaded twice if i load it twice.
I need to add a texture to cache explicitly or it makes it by default?
So i'd like to know the best way to use TextureManager wisely.
Thks!
idealy u should have ur custom art pipeline that reads in binary texture files instead of reading raw image files.
and caching the texture should be one of the core features of the pipeline.
So TextureManager doesn't do it for me?
clovis said:
So TextureManager doesn't do it for me?
im not really sure, but even if it does, u shouldnt be using raw image files anyways. TextureManager is for intermediate texture files.
How do you convert a raw image file into a binary texture file?
TextureManager has an addToCache method. Is there any reason I should not use this to cache?
Last when and why should I cache a texture?
Grahf said:
How do you convert a raw image file into a binary texture file?
use binaryExporter export ur Texture object with the Texture.DEFAULT_STORE_IMAGE = true; make sure u put this line in the constructor of the exporter. i have a simple TextureExporter written, if u still need help on how to do this. i can post the code if u want.
Grahf said:
TextureManager has an addToCache method. Is there any reason I should not use this to cache?
no. theres no reason not to use that. in fact that cache should work fine if u do want to use TextureManager as ur pipeline.
Grahf said:
Last when and why should I cache a texture?
in general, u always want to cache ur texture so multiple objects can use the same memory. but if a texture changes over time, u need to create a clone of that texture object.
If you're only using TextureManager.loadTexture to load your textures they will be cached and loaded from the cache automatically.