Ch40zzC0d3r , everyone says that getting the FrontBuffer is slow. I'm browsing for other methods.
Searching again on google gave another result, direct quote:
I'm trying several methods to capture screen with DirectX and I've come up with 3 methods so far:
•GetFrontBufferData() - Average execution times: •GetFrontBufferData(): 0.83598 s
•D3DXSaveSurfaceToFile(): 0.0036 s
•Total: 0.83958 s
•GetBackBuffer() - Average execution times: •GetBackBuffer(): 0 s <-- INTERESTING - WHY?
•D3DXSaveSurfaceToFile(): 0.2918 s
•Total: 0.2918 s
•GetRenderTargetData() - Average execution times: •GetRenderTargetData(): 0.00928 s
•D3DXSaveSurfaceToFile(): 0.00354 s
•Total: 0.01282 s
Average times have been computed by taking 50 screenshots and by measuring time with clock().
A quick glimpse on GetRenderTargetData - Copies the render-target data from device memory to system memory.
I have to read more on what a "surface" is
Another note, I found some interesting examples on encoding/decoding, but they output to a file stream, so I'll have to learn how to make this data go through a socket. I guess it wont be that much different...
Here's the examples, if anyone is interested in making a video player
:
https://ffmpeg.org/doxygen/trunk/encoding-example_8c-source.html