如何捕获 Windows 上的桌面,以便捕获 directX 和正常渲染的屏幕部分?
简单的例子 - 一方面我们看到相机通过标准软件渲染“输入”,另一方面(标记为“输出”)通过一些 directX 东西渲染(至少在我看来):
那么 windows api 或 DirectX api 提供了什么功能来捕获这种混合场景呢?
Simple example - on one side we see camera rendered via standard software rendered "Input" on other hand (labeled "Output") rendered via some directX stuff (at least it seems to me) :
So what function is provided by windows api or DirectX api for capturing such mixed scenes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
TightVNC Server 可以做到这一点,您可能想看看他们在做什么。简单地浏览一下他们的源代码,看起来他们正在创建一个镜像主屏幕的虚拟屏幕。
具体来说,请查看
CreateCompatibleDC
和CreateDIBSection
API 的TightVNC Server can do it, you may want to look into what they are doing. From a simple glance through their source code it looks like they are creating a virtual screen that mirrors the primary screen.
Specifically though, look into the
CreateCompatibleDC
andCreateDIBSection
API's据我所知,虽然我们可以在屏幕上看到,但没有直接的方法来捕获 DirectX 渲染区域。因为真正的渲染动作(又名渲染指令)发生在硬件层。所以标准SDK中的API无法知道最终的渲染结果,从而导致黑色方块。
做到这一点的唯一方法可能是将您的希望寄托在渲染层(例如 DirectX 引擎)本身能够支持输出接口以及底层渲染操作。所以我建议检查一些文档以查找是否确实存在。
As I known, there is not a direct way to capture DirectX render area, although we can see that on the screen. Because the real render action(aka render instruction) happens in hardware layer. So the API in standard SDK cannot know the finally render result, which lead to the black square.
The only way to do this maybe put your hope on the Render layer(such as DirectX engine) itself can support output interface as well as underlying render action. So I suggest to check some documentation to find if there indeed is.
DirectX 可以呈现给您提供的窗口的有限部分,使您能够在较大的窗口中创建 DX 内容的小区域。
DirectX can present to a limited subsection of the window that you give it, enabling you to create small regions of DX content in larger windows.