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.