   Direct3D 11 Depth
  Hi, I'm having a problem with depth in Direct3D 11. I made a screen shot illustrating my problem here: http://img193.imageshack.us/img193/9601/depth.pngI've looked around and tried several things, I also made a little test program in OpenGL comparing the function calls related to depth in my Direct3D 11 application etc. It works fine there. My depth buffer format is DXGI_FORMAT_D32_FLOAT.Here's what I'm doing:D3D11_RASTERIZER_DESC rasterizerDesc;memset(&rasterizerDesc, 0, sizeof(rasterizerDesc));rasterizerDesc.FillMode = D3D11_FILL_SOLID;rasterizerDesc.CullMode = D3D11_CULL_NONE/*D3D11_CULL_BACK*/;rasterizerDesc.DepthClipEnable = TRUE;rasterizerDesc.MultisampleEnable = (sampleCount > 1);result = d3dDevice->CreateRasterizerState(&rasterizerDesc, &d3dRasterizerState);d3dContext->RSSetState(d3dRasterizerState);D3D11_DEPTH_STENCIL_DESC depthStencilDesc;memset(&depthStencilDesc, 0, sizeof(depthStencilDesc));depthStencilDesc.DepthEnable = TRUE;depthStencilDesc.DepthWriteMask = /*D3D11_DEPTH_WRITE_MASK_ALL*/D3D11_DEPTH_WRITE_MASK_ZERO;depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS;depthStencilDesc.StencilEnable = FALSE;result = d3dDevice->CreateDepthStencilState(&depthStencilDesc, &d3dDepthStencilState);d3dContext->OMSetDepthStencilState(d3dDepthStencilState, 0);Render loop:d3dContext->ClearRenderTargetView(d3dRTV, CLEAR_COLOR);d3dContext->ClearDepthStencilView(d3dDSV, D3D11_CLEAR_DEPTH, 1.0f, 0);d3dContext->IASetInputLayout(d3dLayout);d3dContext->IASetVertexBuffers(0, 1, &vertexBuffer, &stride, &offset);d3dContext->IASetIndexBuffer(indexBuffer, DXGI_FORMAT_R32_UINT, 0);d3dContext->VSSetShader(d3dVS, NULL, 0);d3dContext->PSSetShader(d3dPS, NULL, 0);d3dContext->PSSetSamplers(0, 1, &d3dSamplerState);for (int i = 0; i < numMeshes; i++){  Mesh& mesh = meshes;  d3dContext->PSSetShaderResources(0, 1, &mesh.shaderResource);  d3dContext->DrawIndexed(mesh.numIndices, mesh.firstIndex, 0);}swapChain->Present(0, 0);Hope someone can solve my little mistake!Thanks!   
  This right here:depthStencilDesc.DepthWriteMask = /*D3D11_DEPTH_WRITE_MASK_ALL*/D3D11_DEPTH_WRITE_MASK_ZERO;You're specifying that the depth buffer shouldn't be written to at all, which is why the depth test is always passing.   ;  Yeah, I was playing with the values a bit because I was at a loss. But changing it to D3D11_DEPTH_WRITE_MASK_ALL, makes it worse and now the entire world is visible to me. I must've done something stupid somewhere, but I can't find it. :-P   