Please forgive me if I'm asking a question that has been answered before, but for the life of me, search as I might, I couldn't find a problem exactly like this anywhere.

I'm trying to render a series of sprites, all sourced from transparent PNGs, to a texture. Each of these rendered textures would be layers in a 2D environment which could be subjected to shaders/effects before being placed on the screen.

My problem is that when I try this, the screen fills with black, and only the last texture rendered is visible.

I have tried: * clearing the graphics device after setting my render target, using color.transparent. * every surface format (those formats mean nothing to me at this interim)

I am new to this particular environment, so I am probably missing something that I can't easily look up.

  • \$\begingroup\$ What settings do your PNGs have in monogame pipeline tool? \$\endgroup\$ Jul 17, 2019 at 6:06
  • \$\begingroup\$ @trollingchar - Premultiplied Alpha, format is color. I actually just sort of solved the problem a moment ago, by just drawing everything to a texture, and only putting those rendertargets onto the screen. In other environments I've worked in, that's never been an issue, but everything has its quirks. \$\endgroup\$
    – user130089
    Jul 17, 2019 at 6:12
  • \$\begingroup\$ If you solved your own problem, post an answer, so anyone checking it out in the future can find the solution too. \$\endgroup\$
    – Bálint
    Jul 17, 2019 at 16:17
  • \$\begingroup\$ My gut feeling is that it's possible to solve this but you'd need to provide a little more context. Post some code that you've tried (it doesn't need to be everything, just the last thing that didn't work) and provide details about the platform you're targeting (Windows? OpenGL or DirectX?) \$\endgroup\$ Jul 17, 2019 at 23:45
  • \$\begingroup\$ @craftworkgames - I'm targeting multi=platform desktop, which implements GL despite asking for DX-centric stuff going in. I did manage to solve the problem, though this being a problem is more bizarre considering it's GL once it builds. If you draw a RenderTarget2D to the screen, it will wipe any plain Batch.Draw(Texture2D ...) results from the buffer for some reason. GL doesn't normally do that, so I will chalk it up to something weird in MonoGame/XNA's wrapper. RenderTarger2D's can draw over each other fine though. \$\endgroup\$
    – user130089
    Jul 18, 2019 at 12:57

1 Answer 1


Turns out, while no documentation I've seen backs this up, that if you throw a texture2D directly at the screen via rendertarget being null, it gets wiped out by any RenderTargets you draw via SpriteBatch.Draw(). I've never encountered this in any other platform, but I also haven't used every platform in the universe, so this could be more commonplace than I would initially think.

Feel free to correct me if this is a symptom of something I'm missing, but problem solved regardless.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .