I am working on an application that uses the XNA framework for 3D rendering. Now I want to load a texture from a file. So far I have found two methods:
Texture2D.FromStream(GraphicsDevice, Stream) The problem with this approach is that it only loads gif, png and jpg, and I also need tga image support.- Create a
ContentManager object. The problem with this approach is that it seems that all textures should be statically added to the project from the documentation: "Before the ContentManager can load the object, you need to add the asset to your game project." This program is a level editor and what textures are needed is not known in advance.
Is there any other easy way to load a texture, I'm thinking of using some other class to load an image (although I don't know what, I'm not very familiar with C #), and then maybe the Texture2D.SetData method?
Is there any other easy way to achieve what I am trying to achieve?
Andreas Brinck
source share