justinstenning / Direct3DHook

DirectX Capture and Overlays by using Direct3D API hooks
http://spazzarama.com/2011/03/14/c-screen-capture-and-overlays-for-direct3d-9-10-and-11-using-api-hooks
MIT License
582 stars 176 forks source link

[d3d9 hook] Capturing screenshot is borked if there are multiple backgroundbuffers #3

Closed bitterskittles closed 11 years ago

bitterskittles commented 12 years ago

the snapshot function doesn't work if the application calls EndScene multiple times before swapping the framebuffers.

however, hooking IDirect3DDevice9::Present method instead of EndScene, using the eaxact same method body, works. (tested with DirectX SDK samples)

justinstenning commented 11 years ago

I have an updated version of this that hooks the Present or PresentEx methods as necessary (Present is not always used on D3D9Ex devices).

bitterskittles commented 11 years ago

Thanks for mentioning PresentEx. I missed that one, though I haven't had issues with the programs I hooked so far. I'll update my code to handle PresentEx as well.

justinstenning commented 11 years ago

@bitterskittles I have uploaded changes that now use Present/PresentEx by default (major code restructure also) and changed from SlimDX to SharpDX

bitterskittles commented 11 years ago

cool thanks. any reason for the switch to SharpDX? does it have less overhead penalty than SlimDX?

bitterskittles commented 11 years ago

I was googling SlimDX vs SharpDX and found this article http://robjsoftware.org/2012/07/18/slimdx-vs-sharpdx/ :)