Does MonoGame not allow large textures like (20,000 x 1,000)?

It runs perfectly when I load the texture that’s smaller but when I increase the image size to 20,000 by 1,000 pixels it gives me this error

I’m using Windows 7 and direct x. .NET framework 4.

When I replace the texture file with the smaller version (same file name so same exact code), I don’t get an error

1 Like

It’s not a MonoGame limitation but the hardware in your PC. Since textures are created on the GPU, we are bound by the size restrictions imposed by the GPU. The upper limit on texture sizes depends on the particular model GPU you have, but it could be around 8192 or 16384 pixels per side.

1 Like

It’s heavily suggested to use a power of two for textures.

XNA (Reach Profile) - 2048
XNA (HiDef Profile) - 4096 - 8192
MonoGame - 4096++ (?)

You can get away with it on windows and even other platforms
You will lose all the ability to go crossplatform im pretty sure that is the case.

For example you can add a System.Image.Drawing reference and use the bitmap class and load huge images via system.Io using one of the stream classes, but that wont work on anything but windows. Further you have to load them into system.bitmap.color arrays then convert them to separate smaller mono game color arrays which is really actually simple you just cast the grba to rgba and then load them into separate textures using setdata<>

The upside to this is after you do all that you will realize your going to have to mipmap them and chop them up further for any real game and possibly for a image editor or any app as well.

But this is sort of a real problem just to get them in on any platform if they are large on file. Especially if you want to make a simple paint program in monogame that can load large images :frowning: it was in xna too.

If you are not using mipmaps or texture compression then power of 2 resolution it is not that important.

Furthermore resolution is directX feature level limitation. Dx10 max texture width/length is 8k. For more details refer to At DX11 you will be fine up to 16kx16k. If that isn´t enough then there are ways how to use multiple texture properly mapped to one UV set.

Does this mean basically if you want a game that is cross-compatible, don’t have any textures larger than 2048x2048?

Side question, is it DirectX 9 that limits 2048?

I just had a scimilar issue… I load data from large textures which are then discarded…

Yeah, you can reduce file size to something smaller,
but what helped me, and required no work, was making sure to run in 64 bit mode, not x86…
Something about memory management :slight_smile:

Yes, 2048x2048 is the largest supported size on iOS and most Android, even though on older hardware you’d hit the memory limit even before the actual size limit of the texture. Make your decisions based on your target hardware.