Archived

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

Dmitry Vasilijev

DirectX question

Recommended Posts

Anybody tried to read values directly from ZBuffer surface? I think that it may be very useful for 3D object selection. I tried to use GetDC() and surface pointer but I read only zero values. please help me if you did it...

Share this post


Link to post
Share on other sites
zerwit    122
I''m not sure if you can read directly from the zbuffer, but if you can then just lock the surface, and read the pixels.

*** Triality ***

Share this post


Link to post
Share on other sites
Thanks for answer.

I did it!!!
Simply I forgot to clear DDSURFACEDESC2 before I call IDirectDrawSurface.Lock().
And I''ve surprised that it get not very high perfomance hit.
I lock/UnLock surface to read the Z values near the 10 times per frame and I lose only 3-8 FPS.

Share this post


Link to post
Share on other sites