Archived

This topic is now archived and is closed to further replies.

Tamer_Malas

Getting the depth of a point...

Recommended Posts

How can i get the depth of a point(with respect to screen) situated in the depth buffer? for example if i want to know the depth of a point (20,50) in the screen. i have tried the function dev->GetDepthStencilSurface(&zbuffer_surface) but when getting the surface it appears to be cleared!!! i have conclused that when trying to get the dc by using the function zbuffer_surface->GetDC(&dc) the dc is always cleared!!! and also i have tried the zbuffer_surface->LockRect(.....) but the locked rectangle is always NULL what can i do?

Share this post


Link to post
Share on other sites
One thing: you may should think of raytracing/raycasting for this kind of stuf, but anyways,
You cannot lock a depth-buffer unless it''s created using the D3DFMT_D16_LOCKABLE surface format. I''ve never used it before but i think it''s not the most fast way to render your scene. Anyway it could work for you

Cheers,

Share this post


Link to post
Share on other sites