Search code examples
graphicsdirectxgdi

DirectX - BackBuffer concept


I am new to DirectX, and after spending some time in reading the documentation I came to know that there are two video buffers, the FrontBuffer and the BackBuffer. I am performing a POC to verify the fastest method of screen capture, and the BackBuffer, according to some sources might do this trick. (FrontBuffer access is too slow for me)

But unfortunately there aren't so many good articles on the internet that explains the theory in detail. I have some questions that also might help others, if answered.

  1. Is the back buffer simply a surface where an application can write into?
  2. Is the back buffer application specific? i.e. separate back buffer for each DX app?
  3. If I am running some app which shows some data on screen using DirectX, can I capture its back buffer? (According to FRAPS analysis a DLL can be hooked to the app to do this. But any guidelines?)

Solution

    1. Yes. Depending on which version of DirectX you use, the back buffer is a surface or texture created as a render target.
    2. Yes. Every application has its own back and front buffer. An application is not even limited to using one back buffer. Instead it could use three or more buffers or no back buffer at all.
    3. Well, I am not an expert at hooking DirectX applications, but this should be possible. Basically, you would replace the Present method with a method that captures the buffer before presenting it. See here for some additional Information.