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... 3 years 3 months ago #547

  • Posts:4
  • flacon's Avatar
  • flacon
  • Fresh Boarder
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;
  7. if (_d2dSurfaceBitmap == null)
  8. _d2dSurfaceBitmap = new Bitmap1(_deviceManager.ContextDirect2D, new DrawingSize(1000, 800), bitmapProperties);
  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;
  16. RenderTarget renderTarget = new RenderTarget(_bmpDeviceManager.FactoryDirect2D, _d2dSurfaceBitmap.Surface, rtProps);
  18. renderTarget.BeginDraw();
  19. renderTarget.DrawLine(point0, point1, _bmpSceneColorBrush);
  20. renderTarget.EndDraw();
Last Edit: 3 years 3 months ago by flacon.
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 0.227 seconds