You have another very related question here. I'll answer both.
Let me reword your question: "I have a window which has been rendered with OpenGL in another app (or in a not-touchable code part of my app). How can I add my own render to this window, adding or replacing pixels?"
That other app (let's call it 'appA') has done some tasks: Created a window, created a gl-context (ctxA), set that context as current to some thread (thrA), done rendering and finally used SwapBuffers to see the result in the screen.
The easy case is when appA code is part of your appB code, and appA has not called SwapBuffers yet, and you have the window handle and the ctxA. Then you can do the same proccess: Set ctxA current to your thread (thrB or even thrA if you have access to it, e.g. is the same main thread), do your rendering an call SwapBuffers.
==>But you must know which OpenGL version is used by appA, and do your OpenGL job with the same version.
==>You must also be sure that appA does not execute any OpenGL command while your appB has set ctxA as current for your thread.
A more difficult case is when you can't be sure about appA doing its rendering at the same time appB renders too. You can use a shared context ctxB (so it shares with ctxA most data) which you set as current to your own thread thrB.
==>The issue is that there's no way of knowing who renders first, appA or appB.
If you are getting the whole picture then you see that your main issue is that you need to prevent appA from calling SwapBuffers. If you have this possibility then use your own ctx, thread and OpenGL stuff with the same window. You should be able to read the default framebuffer by ReadPixels.
The worst case is when you have the window and nothing else, or when SwapBuffers has been already called. You still have a chance: use code injection. This technic grabs the call to SwapBuffers from the graphics driver. Then, when it's called, do the pixels modification, and let the SwapBuffers run as before grabbing.