I was just trying to add some glowing effect to my UI and was wondering, why the background always gets black.
After some graphics debugging and a lot of try & error I found out, that changing the RenderTarget(s) of GraphicsDevice the screen will be cleared. (Appears black, obviously it’s transparent, which my graphics debugger showed me.
RenderTargetBinding originRenderTargets = GraphicsDevice.GetRenderTargets(); GraphicsDevice.SetRenderTarget(glowRenderTarget); GraphicsDevice.SetRenderTargets(originRenderTargets);
Removing the second line will cause no changes and my scene is drawn as it should be.
I also tried out, what happens using a RenderTarget object from beginning (e.g. screenshot) and found out that it really doesn’t matter, if the originRenderTargets are null or not.
Is this a bug? Or is it just necessary to do it in another way?
In current my project’s drawing the UI between setting RenderTarget to glowRenderTarget and Setting it to origin (which used to be null)
Windows 10 Pro
- Notebook: Intel® HD Graphics 4400
- Tower: NVIDIA Gtx 970
Thanks for helping