Skip to main content
GameDev.net gamedev.net
🔒 Locked

[DX10][SlimDx] DepthBuffer cause Blinking

Started by Pasofec May 24, 2009 at 11:40 AM 0 replies 1.2k views
Original Post
Pasofec
Pasofec
Hi I am using SlimDx and sample framework and trying to get into work depth testing. But everything i draw blinks. Sometimes is drawen, sometimes not and sometimes it is broken. Device init ... GraphicsDeviceManager initialize DepthStencilView by sended format.
  
            DeviceSettings desiredSettings = new DeviceSettings();
            desiredSettings.DeviceVersion = DeviceVersion.Direct3D10;
            desiredSettings.Windowed = true;
            desiredSettings.BackBufferWidth = InitialWidth;
            desiredSettings.BackBufferHeight = InitialHeight;
            desiredSettings.DepthStencilFormat = SlimDX.Direct3D9.Format.D24S8;
            

            GraphicsDeviceManager.ChangeDevice(desiredSettings);

DepthStencilState init
  
            DepthStencilStateDescription dssd = new DepthStencilStateDescription();
            dssd.IsDepthEnabled = true;
            dssd.IsStencilEnabled = false;
            dssd.DepthWriteMask = DepthWriteMask.All;
            dssd.DepthComparison = Comparison.Less;
            
            DepthStencilState dss = DepthStencilState.FromDescription(Device, dssd);
            Device.OutputMerger.DepthStencilState = dss; 

and Draw
  
            Device.ClearRenderTargetView(GraphicsDeviceManager.Direct3D10.RenderTarget, ClearColor);
            Device.ClearDepthStencilView(GraphicsDeviceManager.Direct3D10.DepthStencilView, DepthStencilClearFlags.Depth, 1.0f, 0);

            Device.InputAssembler.SetInputLayout(layout);
            Device.InputAssembler.SetPrimitiveTopology(PrimitiveTopology.TriangleList);
            Device.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertices, Marshal.SizeOf(typeof(Vertex)), 0));

            for (int p = 0; p < technique.Description.PassCount; p++)
            {
                pass.Apply();
                Device.Draw(points.Length, 0);
            }


I am quite sure that i am badly clearing DepthStencil, but i have no idea now, what to to with it. Thanks for any help
Pasofec
Pasofec
Solved
I had nearPlane = 0;

lame ...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.