简体   繁体   English

如何在 windows 上捕获桌面,以便捕获 DirectX 和正常渲染的屏幕部分?

[英]How to capture desktop on windows so that it would capture both directX and normally rendered parts of screen?

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):简单的例子 - 一方面我们看到通过标准软件渲染的相机渲染“输入”另一方面(标记为“输出”)通过一些directX东西渲染(至少在我看来):

在此处输入图像描述

So what function is provided by windows api or DirectX api for capturing such mixed scenes?那么windows api提供什么function或DirectX Z8A5DA52ED12647217D359E70A8这样的混合场景?

TightVNC Server can do it, you may want to look into what they are doing. TightVNC Server 可以做到,你可能想看看他们在做什么。 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 and CreateDIBSection API's具体来说,请查看CreateCompatibleDCCreateDIBSection API

As I known, there is not a direct way to capture DirectX render area, although we can see that on the screen.据我所知,没有直接的方法来捕获 DirectX 渲染区域,尽管我们可以在屏幕上看到它。 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.所以标准 SDK 中的 API 无法知道最终渲染结果,从而导致黑色方块。

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.唯一的办法可能是寄希望于渲染层(例如 DirectX 引擎)本身可以支持 output 接口以及底层渲染动作。 So I suggest to check some documentation to find if there indeed is.所以我建议检查一些文档以查找是否确实存在。

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. DirectX 可以呈现给您提供的 window 的有限部分,使您能够在较大的 windows 中创建小区域的 DX 内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM