从GPU获取完整的桌面屏幕截图 [英] obtaining full desktop screenshot from the GPU
问题描述
我一直在使用Windows API的BitBlt
函数执行屏幕抓取.
I have been using the Windows API's BitBlt
function to perform the screen grab.
但是有很多缺点:
- DWM和Aero会导致速度大幅下降(3ms-> 35ms只是为了呼叫
BitBlt
)-要解决此问题,需要禁用Aero,而我宁愿不这样做.屏幕闪烁,事物四处移动. - 必须将数据重新传输到GPU才能将数据作为纹理加载 如果没有
- 分层的Windows.启用后,捕获时鼠标光标闪烁.这似乎是一个小问题,但是当该应用程序没有错误时,这将非常烦人.作为一种解决方法,我打算将分层的窗口渲染为附加光标.
CAPTUREBLT
标志,则无法捕获- 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. - Data must be re-transferred to the GPU in order to load data as texture
- 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屋!