1

I want to load tilesets into xna using Texture2D.FromStream(...), that are bigger than 4096*4096 and there are many of them so i don't want to crop each of them manually.

Can i load them anyway? And if not, is it possible to load a texture partially?

x2.
  • 9,554
  • 6
  • 41
  • 62

1 Answers1

0

You can't get around loading the max size of a texture in XNA. Your best bet is loading it as a bitmap using System.Drawing.Bitmap and resizing it as a bitmap then load it as a texture.

Lockdowne
  • 474
  • 3
  • 7
  • Could you write an example-code? I usually don't work with bitmaps in this context. – Michael Rynkiewicz Jul 21 '14 at 10:42
  • I actually just remembered that when you use the FromStream method, that I believe it shrinks the texture down to fit the maximum size. So perhaps you could load your big images, then scale them up when you draw the image. If this is right I'll add it to my answer. – Lockdowne Jul 22 '14 at 02:59
  • I tried it and it would work but the textures are to ugly when i rescale them to the old size. Since i asked the question i have already croped the textures manually. It was the easier way. – Michael Rynkiewicz Jul 22 '14 at 13:08