Tuesday, May 26, 2015

xna - How can I use a Texture2D larger than 2048 x 2048?



I'm having issues working with a large image. I've read other threads on using images larger than a Texture2D supports, but found nothing that addresses my problem specifically with implementation hints.


My screen resolution is 1920 x 1080. I'm working in C# XNA. The game in question is pretty much a board game.


I have an 3840 x 3840 image I planned to use for the terrain map. The idea was to make each new game look a little different from the last by having the program randomly select a 1920 x 1080 segment of that large image to display. My code to randomly select and display a part of the image is working.


Unfortunately, I can't even get the initial 3840 x 3840 image to load. Just picking "Add Existing Item" and adding the image to the content window on the right causes my program to error that a Texture2D can only be 2048 x 2048 maximum.


How do I best handle this? I may later need to scale or rotate the map.




Suggestions I've seen around:



  • Cut it up into sections.

  • Use a smaller image that is made "seamless" or "tile-able", then choose a random starting X,Y point in it and fill the screen with that.



Are these good ways to go about it? How would I actually do this? Would I still be able to scale and rotate the map?




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...