I want to get the depth of vertex in 0 to 1 range(like it done in the shader) and I do it like this
D3DXVec3TransformCoord(&vertex, &vertex, &wvp); depth = vertex.z;
It works(sometimes wrong) but when I write This
if (depth > 1.0f || depth < 0.0f)return false;
Sometimes it returns false. How can I get correct depth for vertex in 0 to 1 range??
I want to compare two vertexes and select the nearest
wvp = worldmatrix*viewmatrix*projectionmatrix;
It works wrong when I zoom in