示例#1
0
        public void BeginFrame()
        {
            Debug.Assert(curView == null);

            using (var backBuffer = chain.GetBackBuffer <Texture2D>(0))
            {
                curView = new RenderTargetView(Device.Get().Handle, backBuffer);
            }
        }
示例#2
0
        public SwapChain(IntPtr hwnd, int width, int height)
        {
            Width  = width;
            Height = height;

            var desc = new SwapChainDescription
            {
                BufferCount       = bufferCount,
                Flags             = flags,
                IsWindowed        = true,
                ModeDescription   = new ModeDescription(width, height, new Rational(0, 1), Format.R8G8B8A8_UNorm),
                OutputHandle      = hwnd,
                SampleDescription = new SampleDescription(1, 0),
                SwapEffect        = SwapEffect.FlipSequential,
                Usage             = Usage.RenderTargetOutput
            };

            var device = Device.Get();

            chain = new SharpDX.DXGI.SwapChain(device.FactoryHandle, device.Handle, desc);
        }