从 GPU 获取完整的桌面截图 [英] obtaining full desktop screenshot from the GPU

查看:89
本文介绍了从 GPU 获取完整的桌面截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 Windows API 的 BitBlt 函数来执行屏幕抓取.

I have been using the Windows API's BitBlt function to perform the screen grab.

但是有很多缺点:

  1. DWM 和 Aero 会导致大幅减速(3 毫秒 --> 35 毫秒只是调用 BitBlt)——要解决这个问题需要禁用 Aero,而我宁愿不这样做.屏幕闪烁,东西移动.
  2. 必须将数据重新传输到 GPU 才能将数据作为纹理加载
  3. 如果没有 CAPTUREBLT 标志,则无法捕获分层 Windows.启用后,鼠标光标会在捕获时闪烁.这似乎是一个小问题,但是当应用程序没有错误时,它会非常烦人.作为一种解决方法,我打算将分层窗口渲染为附加光标.
  1. DWM and Aero cause a massive slowdown (3ms --> 35ms just to call BitBlt) -- to work around this would require disabling Aero which I'd just rather not do. The screen flickers and things shift around.
  2. Data must be re-transferred to the GPU in order to load data as texture
  3. Layered Windows cannot be captured without CAPTUREBLT flag. When enabled, the mouse cursor blinks when capturing. This may seem like a minor issue, but it is exceedingly annoying when the application is otherwise bug-free. As a workaround for this I intend to render a layered window as an additional cursor.

我已经在使用 OpenGL 来显示和操作捕获的屏幕数据.BitBlt 为我提供像素数据,将其加载到纹理中相对容易.然而,这有点荒谬,因为当数据应该在 GPU 上可用时,我手动将数据重新发送回 GPU.数据肯定在那里,但尝试访问它是另一回事.

I am already using OpenGL to display and manipulate the captured screen data. BitBlt gives me the pixel data and it is relatively easy to load it into a texture. However this is slightly absurd because I am manually re-sending the data back to the GPU when it should be available on the GPU to begin with. The data most certainly is there, but trying to access it is a different matter.

我认为此功能在供应商的待办事项列表(或可能在任何列表中)的位置并不高,但我想问问知情人士是否有 AMD 提供的任何规定(ATI) 或 NVidia 在他们的驱动程序中读取屏幕缓冲区(例如进入 OpenGL 上下文).我只是对现代 GPU 架构了解不够,不知道从哪里开始寻找答案.

I presume that this functionality is not high on the to-do list (or likely on any list for that matter) for vendors but I would like to ask those in the know if there are any provisions at all provided by AMD(ATI) or NVidia in their drivers for reading the screen buffer (into an OpenGL context for instance). I simply do not know enough about modern GPU architecture to know where to start digging for answers.

推荐答案

OpenGL 只能读取上下文帧缓冲区(一个窗口),以及您创建的任何帧缓冲区或 pbuffer.OpenGL 无法触摸桌面或任何其他窗口.

OpenGL can only read the context framebuffer (a window), and any framebuffers or pbuffers you have created. OpenGL cannot touch the desktop or any other window.

这篇关于从 GPU 获取完整的桌面截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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