Loading texture bigger than 4096 using (var stream = new FileStream("Content/4097x1000.png", FileMode.Open)){ _tex = (Texture2D.FromStream(GraphicsDevice, stream)); }
causes: System.InvalidOperationException: This image format is not supported ---> SharpDX.SharpDXException: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments]
Texture size is not a big problem – I can slice bitmaps to 4096 segments.
The main issues for me is the limit for window size - I need more than 4096 in width… much more. Is there any way to fix it?
This thread here suggests that this limit is imposed by your graphics hardware, not MonoGame.
The issue with the window size is, that setting the backbuffer is not the same as setting the window-size.
The backbuffer is the maximum resolution you’ll be able to draw (think of it as a big texture) and that’s going to be displayed on the monitor. Obviously the restrictions of point 1 applies here as well, so you won’t be able to draw a higher resolution that 4096x4096 with your hardware.
Nevertheless you’ll be able to draw to a bigger window… Your image will be resized automatically.
Use your maximum backbuffer height and width (4096x4096), set GraphicsDeviceManager.HardwareModeSwitch to false and IsFullScreen to true. That will give you a borderless fullscreen window if I’m not mistaken.
I’m pretty sure it’s not a hardware issue --> I tested it on 2 machines:
laptop with GTX 960M
desktop with GTX 1080
…if not 1080 then who can do it?
Anyway, to cut “it’s your hardware’s fault” speculations I can add that using MG 3.5.1 I have no problems with setting backbuffer to 9720x3840 [resolution I need] and loading same size [and event bigger, up to 16k width] textures.
Unfortunately 3.5.1 has different issues so I’d love to move to 3.6.
I was seeing the same issue when switching to 3.6, but I was using 3.4 before that. I normally don’t save textures larger than 4096, but I accidentally had one saved as 5000 and I hadn’t noticed until 3.6 crashed on me for trying to load it.
Unfortunately I don’t have a solution or a reason for it, but you aren’t alone in experiencing it.