OpenGL/D3D: Rendering to another applications window
I'm developing an app that needs to be able to draw to other OpenGL/D3D application window. Think of it as adding an extra overlay HUD to a game, but from an external app. For now, I'm just focusing on OpenGL since it's a bit more straightforward to work with, and I'm experimenting with drawing to Counter-Strike. I've succeeded in drawing with GDI (ie TextOut) to the CS-window but I'm getting a lot of flicker since I don't really know when to update the drawing and I'm just doing it as fast as i can. Since GDI works, I guess I could render my stuff to an offscreen DC and use BitBlt to copy it onto the window, but the flickering problem remains.
The optimal solution would be not having to use GDI at all, but instead just create another rendering context in the existing window. Not sure if that can be done though (no luck so far).
Anyone with any experience in this topic, please respond with feedback on how I should go about doing this. Thanks!