Textures polygons rendering opaque and white in Monogame (not in XNA)

Not sure where to start with this one. I had a look about and can’t see anything obvious that I’m doing wrong. I started writing a game with the XNA 4.0 libraries with the plan of using MonoGame to port it to iOS, Android and Windows Phone. When I swapped out the XNA desktop libraries for the Monogame 3.2 Windows GL Desktop ones I see this:

I’m rendering using DrawUserIndexedPrimitives() in TriangleList mode and BasicEffect. I get the same problem when I use the Windows DirectX libraries.

Any advise on where I should start looking to find the possible source of this issue?

Many thanks,


Check your texture is being loaded and bound. I’ve only run into this issue when my texture was failing to load.
How are you processing the texture? Are you just loading a png or a xnb processed for the platform?

Yeah, definitely being loaded and bound:

(Using F#)

I’m loading the textures with Texture2D.FromStream(). It’s just a PNG. I messed with a png a little and no obvious changes seem to make it load any better…

Anyone with any other thoughts? I feel pretty stuck here, but willing to work pretty hard to resolve this. Seems like there must be a simple enough explanation someplace.

I’ve just noticed that even when I render with VertexColorEnabled = true and set all my vertices to have the colour green, the MonoGame sprites will still render as white opaque squares even when the all render with green tints in XNA.

So I guess the issue isn’t with texture loading and is something more fundamental. Does this ring any bells with anyone?

Could you try draw something using spritebatch to see whether it works?

I just tried it, and lo and behold… it works just fine. I guess I just need to figure out why SpriteBatch works fine while DrawUserIndexedPrimitives doesn’t. Any further thoughts would be more than appreciated. I guess I’ll try writing a new project and try to reproduce the issue.

I would have to say that setting the textures on the effect isn’t being done correctly AND/OR your blendmode isn’t being set before drawing.

I should have responded earlier. I actually resolved this. I’m not 100% sure, but I believe the following ended up fixing it:
Originally I had this in my draw() function:

//other stuff...

Everything worked when I changed it to this:

    //other stuff...

The first one worked fine in XNA but not in MonoGame. The second one worked fine in both. Not sure why this would make a difference. Also not a 100% sure this is what fixed it, but after it started working I didn't feel like spending more time trying to figure it all out exactly.

Thanks for the help ya'll!