C# Capturing Direct 3D Screen

戏子无情 提交于 2019-12-01 00:27:07

问题


I have been fooling around with screen capture for awhile now and I managed to capture the entire screen, certain areas on the screen etc...

But when I go into a game and try to capture the screen, it completely ignores the game and instead, captures the desktop (or whatever is behind the game window). Another interesting fact is that the same thing happens with the PrtScn button.

Any ideas on how to capture a game's screen?


回答1:


The screen capturing technique you are using works well for capturing things that aren't hardware accelerated. I suspect you'd have the same problem trying to capture a movie frame in Windows Media Player.

The solution is the do a screen capture from the hardware itself using DirectX. This article explains how to do that with some code and a managed wrapper around DirectX called SlimDX.

EDIT If Slim DX doesn't work for you, then you'd just have to find another managed wrapper around Direct X. I don't think you are going to be able to do the screen capture without working at the hardware level, and DirectX is the means of doing that on the Windows platform.



来源:https://stackoverflow.com/questions/6142121/c-sharp-capturing-direct-3d-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!