Texture2D Maximum? (MAX_TEXTURE_SIZE)


I’ve created an runtime texture atlas for atlassing tilemaps and animations on runtime. Also I use this for texture sharing. (I push multiple tilesets and animations on one texture!) For Dx I can just use 16384 (Desktop, not ARM) and for GL I want to query MAX_TEXTURE_SIZE.

I have this working on Android:

int t;
GL.GetInteger(GetPName.MaxTextureSize, out t);

But I can’t get it to work on Mac or IOS. I probably need a using directive to make it work.!? But I don’t know which that would be.

Or is there perhaps an other - more generic MonoGame - way to determine the max size of a Texture2D?

Many thanks on any advice on this!

As far as I’m aware, MonoGame/XNA Texture2Ds are limited to 2048x2048, or 4096x4096 if the profile of the project is set to “HiDef”

GraphicsProfile is how you are supposed to handle this under XNA.
The problem is that MonoGame doesn’t implement it.

One way to workaround this is to use try/catch and see if the device let’s you create textures of 16384, 8192 ,4096, etc.

@DJMAX I’m not having any problems allocating Textures > 4096 on DX11 (16384 HiDef) or Android systems that have a bigger MAX_TEXTURE_SIZE then 4096.

I was thinking of trying a solution like that. I will follow up later (days, weeks) on if it will work. It is still kind of “brute force fullness” to do it like that - especially if there are ways like MAX_TEXTURE_SIZE to know in advanced what the correct size is. But if it will work, I gladly use it.! :smiley: