Reading the depth buffer for a given x, y?

Started by
1 comment, last by rahaydenuk 22 years, 3 months ago
Is there a way in DirectX 8.1 to read the value in the depth buffer for given x, y pixel co-ordinates? I know in OpenGL, there is a function ''Unproject()'' or similar, which would achieve the desired results, but I need this for DirectX 8.1. Thanks & HNY, Richard Hayden.
Advertisement
Well.. I don''t really use DX8, only DX7, but I guess you can lock the Z-buffer and get a pointer to it. Once you got that, you just have to read the appropriate value directly from memory. However, be aware that reading FROM video memory is VERY SLOW. If you just read 2-3 pixels per frame it''s ok but don''t hope to read big chunks.

Note : and please do not double post. Thanks.
Sorry about the double posting.

I don''t think you can do this in DX 8 (locking the z-buffer and then reading the vals from memory). Even if you could, as you mentioned it is incredibly slow.

Does anyone know of another possible way?

This topic is closed to new replies.

Advertisement