Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 26 Feb 2013
Offline Last Active Jul 14 2015 07:18 AM

Posts I've Made

In Topic: [SharpDX] Creating a Direct2D render Target from a swapchain

20 February 2015 - 12:19 PM

okay found out my issue. I wan't using Brgasupport creationflag. Thanks so much for your help Drake

In Topic: [SharpDX] Creating a Direct2D render Target from a swapchain

18 February 2015 - 02:43 PM

Okay I attempted it using 2.6.3 DirectX11_2-net40 and I got the same error


The only problem with the dxgidevice is that the output FrameStatistics, GammaControl, and Gammacontrol Capabilities are throwing exceptions. The outputs are in the adapter

In Topic: [SharpDX] Creating a Direct2D render Target from a swapchain

18 February 2015 - 11:04 AM

I appreciate all your help, but I still have a problem with your solution Lordadmiral Drake.The line

var d2DDevice = new SharpDX.Direct2D1.Device(dxgiDevice2);

produces the error Additional information: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.

I'm not sure why either.


Here is my code

        static void Main()
            RenderForm form = new RenderForm("TEST APP");
            Factory fact = new Factory();
            Device dev = new Device(fact.Adapters[0]);
            SwapChain chain = new SwapChain(fact, dev, new SwapChainDescription()
                    BufferCount = 1,
                    Flags = SwapChainFlags.AllowModeSwitch,
                    IsWindowed = true,
                    ModeDescription = new ModeDescription(800, 600, new Rational(1, 60), Format.B8G8R8A8_UNorm),
                    OutputHandle = form.Handle,
                    SampleDescription = new SampleDescription(1, 0),
                    SwapEffect = SwapEffect.Discard,
                    Usage = Usage.RenderTargetOutput

            Texture2D backbuffer = Texture2D.FromSwapChain<Texture2D>(chain, 0);
            RenderTargetView rtv = new RenderTargetView(dev, backbuffer);
            SharpDX.Direct3D11.DeviceContext context = dev.ImmediateContext;

            Surface surf = chain.GetBackBuffer<Surface>(0);
            Factory2 fact2 = new Factory2(FactoryType.SingleThreaded, DebugLevel.Information);
            // Query for the adapter and more advanced DXGI objects.
            var dxgiDevice2 = dev.QueryInterface<SharpDX.DXGI.Device>();

            // Get the default Direct2D device and create a context.
            var d2DDevice = new SharpDX.Direct2D1.Device(dxgiDevice2);
            var _d2DContext = new SharpDX.Direct2D1.DeviceContext(d2DDevice, DeviceContextOptions.None);

            _d2DContext.PrimitiveBlend = PrimitiveBlend.SourceOver;

            var properties = new BitmapProperties1(new PixelFormat(Format.B8G8R8A8_UNorm, SharpDX.Direct2D1.AlphaMode.Premultiplied),
                96, 96, BitmapOptions.Target | BitmapOptions.CannotDraw);

            var _targ = new Bitmap1(_d2DContext, chain.GetBackBuffer<Surface>(0), properties);
            _d2DContext.Target = _targ;


Also what version are you using I'm using 3.0.0 and the DirectX11_2-signed-net40


Thanks Again,


In Topic: Fullscreen Alt-Tab out Problem

02 May 2013 - 04:08 AM


In Topic: Multiple Monitor Fullscreen windows

04 March 2013 - 07:26 PM

Thank You very much MJP =)