Upgrade to MonoGame 3.4 Texture Issue

I upgraded from MonoGame 3.2 to MonoGame 3.4 and I have some sprites that are not appearing after the upgrade.

GL.TexImage2D(TextureTarget.Texture2D, 0, glInternalFormat, this.width, this.height, 0, glFormat, glType, IntPtr.Zero);
GraphicsExtensions.CheckGLError();
GraphicsExtensions.CheckGLError();

Reveals the error:

Microsoft.Xna.Framework.Graphics.MonoGameGLException: GL.GetError() returned InvalidValue

The parameters being used are:

glInternalFormat = OpenTK.Graphics.ES20.PixelInternalFormat.Rgba
this.width = 3840
this.height = 624
glFormat = OpenTK.Graphics.ES20.PixelFormat.Rgba
glType = OpenTK.Graphics.ES20.PixelType.UnsignedByte

Same issue and parameters here.

I’ll keep digging around…

This is likely device specific. I didn’t see this error on Razer Forge TV. I’m seeing the error on OUYA. I have missing sprite issues on both devices. Tracking it down…

Thanks,

~Tim Graupmann

Is that width and height correct? They seem to be odd values.

The port project has a bunch of odd sized textures with sprite sheets. It could be Forge TV is okay with a 4k texture where OUYA has a 2k texture limit.

Given that, both consoles have issues displaying sprites after the upgrade. But the issue is like sprites are being culled and I need to track down the draw calls. It could be a blending issue or a depth issue or something else.

I found the issue.

It’s something related to layerDepth handling that changed between MG 3.2 and MG 3.4.

If I set the layerDepth to zero I can see the sprites fighting, but I least now I know they are being drawn.

		spriteBatch.Draw (Texture2D texture,
			Rectangle destinationRectangle,
			Rectangle? sourceRectangle,
			Color color,
			float rotation,
			Vector2 origin,
			SpriteEffects effects,
			float layerDepth)