Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

windows - obtaining full desktop screenshot from the GPU

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

There are many drawbacks however:

  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.

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.

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...