XNA Creators Club Online
foros de la comunidad
Page 1 of 1 (3 items)
Sort Posts: Previous Next

DepthStencil

Last post 05/11/2009 21:33 by Xtro. 2 replies.
  • 27/10/2009 20:34

    DepthStencil

    Hi, I am using SlimDX library and I have a strange problem.

    I try to add a depth buffer for the MiniTri demo in the SlimDX Open source code but when do that the program shows only a black screen. No triangle is drawn with depth buffer. 

    I just add this code block after the outputmerger.settarget method line.


    Texture2DDescription DepthStencilDescription = new Texture2DDescription();
    DepthStencilDescription.Width = desc.ModeDescription.Width;
    DepthStencilDescription.Height = desc.ModeDescription.Height;
    DepthStencilDescription.MipLevels = 1;
    DepthStencilDescription.ArraySize = 1;
    DepthStencilDescription.Format = Format.D32_Float;
    DepthStencilDescription.SampleDescription = desc.SampleDescription;
    DepthStencilDescription.Usage = ResourceUsage.Default;
    DepthStencilDescription.BindFlags = BindFlags.DepthStencil;
    DepthStencilDescription.CpuAccessFlags = CpuAccessFlags.None;
    DepthStencilDescription.OptionFlags = ResourceOptionFlags.None;

    Texture2D DepthStencil = new Texture2D(device, DepthStencilDescription);
    DepthStencilView DepthStencilView = new DepthStencilView(device, DepthStencil);

    device.OutputMerger.SetTargets(DepthStencilView);


    every thing stays unchanged in the SlimDX's MiniTri demo and it doesn't draw anymore.

    Any ideas ?
  • 31/10/2009 21:46 In reply to

    Re: DepthStencil

    Have you add code to clear the depth stencil buffer like you clear your render target?
  • 05/11/2009 21:33 In reply to

    Re: DepthStencil

    my own answer is that I have to set render target and depthstencil at the same device.OutputMerger.SetTargets call

    device.OutputMerger.SetTargets(DepthStencilView,RenderTargetView);
Page 1 of 1 (3 items) Previous Next