Jump to content
  • Advertisement

Archived

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

Tamer_Malas

Getting the depth of a point...

This topic is 5392 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!