Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Obtaining backbuffer of entire monitor

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2014
    Posts
    6

    Obtaining backbuffer of entire monitor

    For my application, I need to copy the window of a 3rd party application into a texture. I don't have access to the OpenGL context of this 3rd party application, so my hope is that I can access the backbuffer of the entire monitor. The Windows API has a Direct3D method to do this. I'm using Windows 7, but my application is in OpenGL. Is there any way to do this with OpenGL? Or perhaps use the Direct3D method and copy the D3D surface to an OpenGL texture?

  2. #2
    Junior Member Newbie
    Join Date
    Jul 2014
    Posts
    15
    this is a generic question
    1) you need to do screen capture of an application running in a separate process? => you need screen capture API and that is independent of what type of rendering the window is doing (D3D or GL)

    2) the window is in same process of your application, even better same thread (so the window is controlled by some kind of API) => you need to add in someway a callback function when the window is performing any rendering (and has an active openGL context). If the API of the window expose callbacks functions chances are good you will succed in a simple way by simply querying content of backbuffer (i think you just need to bind FBO with id = 0 and read it like in any regular application). The best place to do it is after rendering is finished (because it's harder you can messup GL states, if that is not the case, you have to query states and restore them after you did your work)

    2.b) if the window has crappy API then you can hack it (I don't suggest to do it, I don't know how to do it, It may be legal or not). Just use a code injector and replace the call to "SwapBuffers" with your function that do

    Code :
    -Set your states
    -ReadContent and send to your code (maybe you have a global preallocated buffer that you can easily access)
    -Restore your states
    -SwapBuffers (to preserve functionality)

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2014
    Posts
    6
    Yeah, the application is a separate process and it does not provide me with an API. The D3D::GetBackBuffer method in the Windows API allows you to copy the backbuffer for the entire desktop into a D3D surface, so I thought I could do something like that. Perhaps there is a way to do it in OpenGL, or a way to do it in D3D and convert the surface to an OpenGL texture.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •