
Код: Выделить всё
D3D11_RASTERIZER_DESC rasDesc;
rasDesc.FillMode = D3D11_FILL_SOLID;
rasDesc.CullMode = D3D11_CULL_NONE;
rasDesc.FrontCounterClockwise = true;
rasDesc.DepthClipEnable = true;
rasDesc.DepthBias = 0;
rasDesc.SlopeScaledDepthBias = 0;
rasDesc.DepthBiasClamp = 0;
rasDesc.ScissorEnable = FALSE;
rasDesc.MultisampleEnable = FALSE;
rasDesc.AntialiasedLineEnable = false;
CHECK_ERROR(pDevice->CreateRasterizerState(&rasDesc, &WireFrame));
Код: Выделить всё
rasDesc.FillMode = D3D11_FILL_WIREFRAME

зеленый объект все еще виден, даже если он находится над красной плоскостью.Для справки вот весь код
Код: Выделить всё
D3D11_DEPTH_STENCIL_DESC dsDesc = {};
dsDesc.DepthEnable = true;
dsDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
dsDesc.DepthFunc = D3D11_COMPARISON_LESS;
Microsoft::WRL::ComPtr pDSState;
CHECK_ERROR(pDevice->CreateDepthStencilState(&dsDesc, &pDSState));
pContext->OMSetDepthStencilState(pDSState.Get(),0);
Microsoft::WRL::ComPtr pDepthStencil;
D3D11_TEXTURE2D_DESC descDepth = {};
descDepth.Width = 1022;
descDepth.Height = 574;
descDepth.MipLevels = 1u;
descDepth.ArraySize = 1u;
descDepth.Format = DXGI_FORMAT_D32_FLOAT;
descDepth.SampleDesc.Count = 1u;
descDepth.SampleDesc.Quality = 0u;
descDepth.Usage = D3D11_USAGE_DEFAULT;
descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL;
descDepth.CPUAccessFlags = 0;
descDepth.MiscFlags = 0;
CHECK_ERROR(pDevice->CreateTexture2D(&descDepth, nullptr, &pDepthStencil));
D3D11_DEPTH_STENCIL_VIEW_DESC stencil_view_desc;
stencil_view_desc.Flags = 0;
stencil_view_desc.Format = DXGI_FORMAT_D32_FLOAT;
stencil_view_desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
stencil_view_desc.Texture2D.MipSlice = 0u;
CHECK_ERROR(pDevice->CreateDepthStencilView(pDepthStencil.Get(), &stencil_view_desc, &pDs));
pContext->OMSetRenderTargets(1, pTarget.GetAddressOf(),pDs.Get());
Подробнее здесь: https://stackoverflow.com/questions/786 ... irect-x-11