Transparency between RenderToSurface
-
08-02-2021 - |
문제
In my DirectX application, I need to display some image over the background video/image. I am using RenderToSurface to draw all small images on a single surface and then try to draw over the background video, but the problem it will overwrite my background video and images. How can draw images. My code
Viewport view = new Viewport();
view.Width = _device.DisplayMode.Width;
view.Height = _device.DisplayMode.Height;
_renderingSurface.BeginScene(_renderSurface, view);
_device.Clear(ClearFlags.Target, Color.White, 1.0f, 0);
foreach (REDisplayElement element in this)
{
if (element.IsDisposed == false)
{
element.Draw(true);
}
}
_renderingSurface.EndScene(Filter.None);
}
해결책
I'm more familiar with xna, but aren't you clearing the render target with white, rather than transparency?
You want any pixel on the render target that's not drawn over to be transparent, not white.
제휴하지 않습니다 StackOverflow