Jump to content

  • Log In with Google      Sign In   
  • Create Account

Artifacts when using Direct2d to render on Direct3d backbuffer


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 DrDoktor   Members   -  Reputation: 100

Like
0Likes
Like

Posted 24 April 2012 - 01:38 PM

Hi All,

I have a strange problem. Im mixing Direct3d 10 and Direct2d using SlimDX. When I try to draw to the Direct3d backbuffer using Direct2d, I get artifacts when using the FillEllipse() and DrawEllipse() methods. It looks like the triangulation of the primitives is messed up or something like that. Other methods like FillRectangle() is fine. Ive attached a screenshot showing the result.

When drawing Direct2d to a texture and then draw that texture to the backbuffer using regular Direct3d stuff works fine.

The Direct3d10 device is created with Bgra support
Direct2d part of the renderloop looks like this; (snippet)

...

using (var backBuffer = SlimDX.Direct3D10.Resource.FromSwapChain<SlimDX.Direct3D10.Texture2D>(swapChain, 0))
{
SlimDX.DXGI.Surface d2dSurf = backBuffer.AsSurface();
System.Drawing.SizeF dpi = dx10c.D2DFactory.DesktopDpi;
SlimDX.Direct2D.RenderTarget d2dRt = SlimDX.Direct2D.RenderTarget.FromDXGI(dx10c.D2DFactory, d2dSurf,
new SlimDX.Direct2D.RenderTargetProperties()
{
Usage = SlimDX.Direct2D.RenderTargetUsage.None,
Type = SlimDX.Direct2D.RenderTargetType.Default,
PixelFormat = new SlimDX.Direct2D.PixelFormat(SlimDX.DXGI.Format.Unknown, SlimDX.Direct2D.AlphaMode.Premultiplied),
//HorizontalDpi = dpi.Width,
//VerticalDpi = dpi.Height,
});

d2dRt.BeginDraw();

SlimDX.Color4 color = new SlimDX.Color4(System.Drawing.Color.Black);

SlimDX.Direct2D.SolidColorBrush brush = new SlimDX.Direct2D.SolidColorBrush(d2dRt, color);

d2dRt.FillRectangle(brush, new Rectangle()
{
Height = 100,
Width = 100,
Location = new Point(200, 100),
});

d2dRt.FillEllipse(brush, new SlimDX.Direct2D.Ellipse()
{
Center = new Point(400, 100),
RadiusX = 100,
RadiusY = 100,
});
brush.Dispose();



d2dRt.EndDraw();
d2dRt.Dispose();
d2dSurf.Dispose();


....


}






Anyone else experienced the same problem or know what I do wrong?

Many thanks

Attached Thumbnails

  • Direct2d bug.png


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS