Hi.
I have a question. How i can draw a image on 2 or more windows, using directx11? The windows have different resolution.
How i do it for one window:
1) create swapchain
-
var swapChainDescription = new SwapChainDescription() { BufferCount = 1, ModeDescription = new ModeDescription() { Width = this.WidthImage, Height = this.HeightImage, Format = Format.R8G8B8A8_UNorm, RefreshRate = new Rational(60, 1) }, IsWindowed = true, OutputHandle = handleWindow, SampleDescription = new SampleDescription(1, 0), SwapEffect = SwapEffect.Discard, Usage = Usage.RenderTargetOutput };
?2) CreateWithSwapChain
SharpDX.Direct3D11.Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.BgraSupport, featureLevels, swapChainDescription, out device, out _swapChain);
3) create render target
using (SharpDX.Direct2D1.Factory d2dFactory = new SharpDX.Direct2D1.Factory())
using (Surface surface = Texture2D.FromSwapChain<Texture2D>(_swapChain, 0).QueryInterface<Surface>())
{
_renderTarget2D = new RenderTarget(d2dFactory, surface, new RenderTargetProperties(new SharpDX.Direct2D1.PixelFormat(Format.Unknown, AlphaMode.Premultiplied)));
}
4) render
_renderTarget2D.BeginDraw();
_renderTarget2D.Clear(Color.Black);
renderTarget2D.DrawBitmap(bitmap, new RectangleF(0, 0, 800, 600), 1f, SharpDX.Direct2D1.BitmapInterpolationMode.Linear);
_renderTarget2D.EndDraw();