Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am in the middle of porting over my openGL 3d viewer to a DirectX 10 equivalent. I have come across the fact that there is no glReadPixels equivalent. After a lot of searching on the internet I still haven't found an answer. I use the glReadPixels to get z depth of a pixel under the mouse. Does anyone know the DirectX 10 way of doing this? I need a function that takes the mouse coordinates, queries the z buffer, and reports the depth of the pixel.
Thanks.

What I have tried:

I have searched the internet exhaustively and found nothing
Posted
Updated 30-May-17 22:37pm

1 solution

in dx9 (sorry, but that should get you started) you'd render to a texture (using SetRenderTarget) then get to that texture's surface (GetSurfaceLevel), then lock that and read from it (LockRect)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900