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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top