什么是glreadpixels的direct3d等价物 [英] What is the direct3d equivalent of glreadpixels

查看:73
本文介绍了什么是glreadpixels的direct3d等价物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将我的openGL 3d查看器移植到DirectX 10等效版本。我发现没有glReadPixels等价的事实。在互联网上进行了大量搜索后,我仍然没有找到答案。我使用glReadPixels来获得鼠标下像素的z深度。有没有人知道DirectX 10这样做的方式?我需要一个能够获取鼠标坐标,查询z缓冲区并报告像素深度的函数。

谢谢。



< b>我尝试了什么:



我在互联网上搜索了一遍,没有发现任何内容

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

推荐答案

在dx9中的

(对不起,但是应该让你开始)你将渲染到纹理(使用SetRenderTarget)然后到达纹理的表面(GetSurfaceLevel),然后锁定它并从中读取(LockRect)
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)


这篇关于什么是glreadpixels的direct3d等价物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆