Loading Textures


Texture lensflare = Texture.Load(Mipmapping.Nearest, false,

This code loads the texture in, in the same thread, with Nearest mipmapping, and not repeating (the “false” value).
To load the texture dynamically, use:

Texture lensflare = Texture.DynamicLoad(Mipmapping.Nearest, false,
                                  "Planets/sunflare.ibc", true);

This creates the Texture class for reference, but then schedules the texture for background loading, and loads the texture in a background thread. If the underlying OS does not support background loading (MacOSX or iOS for example)
the texture is loaded immediately. You may use any of the above variations, embed:// or http:// for dynamic loading as well.


To dispose of the texture, either add it to the Scene that it is valid for, and the Texture will be disposed automatically on scene exit, or call the texture.Dispose() method. All currently loaded Textures are automatically disposed on applicaiton exit, but you may wish to dispose of them earlier to save memory.


Like This Post? Share It

Previous Post

Next Post

Leave a Reply

Your email address will not be published. Required fields are marked *