Sorry, the Forum is closed :(

Unfortunately, the forum is now closed.

Please read the following post for further details.

We apologize for the inconvenience.
The SharpDX team.
Welcome, Guest
Username: Password: Remember me
Welcome to the general discussions!
  • Page:
  • 1

TOPIC: [D2D1] Error: An operation failed because a device-dependent resource is...

[D2D1] Error: An operation failed because a device-dependent resource is... 2 years 2 weeks ago #547


  • Posts:4
  • flacon's Avatar
  • flacon
  • Fresh Boarder
  • OFFLINE
Full Error: D2D DEBUG ERROR - An operation failed because a device-dependent resource is associated with the wrong ID2D1Device (resource domain).

I may be going about this completely wrong - I want a surface that I can draw to so that I can then draw that whole surface to the screen, and also save it as a file via WIC. I couldn't find any samples that do anything similar, and this code seems to follow patterns that I've seen in CommonDX.

Any ideas?
  1. var bitmapProperties = new BitmapProperties1();
  2. bitmapProperties.DpiX = _deviceManager.Dpi;
  3. bitmapProperties.DpiY = _deviceManager.Dpi;
  4. bitmapProperties.PixelFormat = new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.R8G8B8A8_UNorm, SharpDX.Direct2D1.AlphaMode.Premultiplied);
  5. bitmapProperties.BitmapOptions = BitmapOptions.Target;
  6.  
  7. if (_d2dSurfaceBitmap == null)
  8. _d2dSurfaceBitmap = new Bitmap1(_deviceManager.ContextDirect2D, new DrawingSize(1000, 800), bitmapProperties);
  9.  
  10. RenderTargetProperties rtProps = new RenderTargetProperties();
  11. rtProps.DpiX = _deviceManager.Dpi;
  12. rtProps.DpiY = _deviceManager.Dpi;
  13. rtProps.PixelFormat = new PixelFormat(SharpDX.DXGI.Format.R8G8B8A8_UNorm, AlphaMode.Premultiplied);
  14. rtProps.Type = RenderTargetType.Default;
  15.  
  16. RenderTarget renderTarget = new RenderTarget(_bmpDeviceManager.FactoryDirect2D, _d2dSurfaceBitmap.Surface, rtProps);
  17.  
  18. renderTarget.BeginDraw();
  19. renderTarget.DrawLine(point0, point1, _bmpSceneColorBrush);
  20. renderTarget.EndDraw();
Last Edit: 2 years 2 weeks ago by flacon.
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 0.219 seconds