DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: OpenGL/D3D: Rendering to another applications window

  1. #1
    Join Date
    Oct 2006

    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!

  2. #2
    Join Date
    Dec 2003
    Direct draw supports double buffering where you draw to one buffer, blt it, draw to the other buffer, flipping each time so only complete surfaces are drawn - which prevents flicker if the programs are able to keep up. Opengl is typically slower on windows than directx, so if you can use this you will be ahead of the game.

    What you might do is have your program writing directly to the display at the same time as the game? If they use the same resolution and refresh rate and all, you might be able to overlay your hud onto the game ? I have never tried that but it could work if the programs cooperate nicely. If both are "windows" and not full screen programs, it should be even easier to overlay one on top of the other.
    Last edited by jonnin; 10-13-2006 at 02:02 PM.

  3. #3
    Join Date
    Oct 2006
    Yeah, I'm enlightened about the existance of multi-buffered rendering surfaces. ;)
    So your suggestion is basically: render faster than the target app, and flip their buffers? I am already rendering (way) faster. Doesn't help.

    I just downloaded Fraps, which can render an FPS display as overlay onto "any" OpenGL/D3D app. Any idea how they do it? More tips please? :)

  4. #4
    Join Date
    Dec 2003
    Not sure. You could try writing directly to the video card's memory instead? You would have to leave the pixels that are not part of your graphic as they were.

Similar Threads

  1. Regarding closing a pop window
    By Usha.R in forum ASP.NET
    Replies: 1
    Last Post: 02-14-2006, 04:30 AM
  2. Replies: 0
    Last Post: 04-19-2001, 03:45 PM
  3. ?API NT Compatability?
    By Dennis in forum VB Classic
    Replies: 10
    Last Post: 02-15-2001, 04:52 AM
  4. child window - is it or isn't it?
    By TC in forum VB Classic
    Replies: 8
    Last Post: 09-26-2000, 02:34 AM
  5. child window - is it or isn't it?
    By TC in forum VB Classic
    Replies: 0
    Last Post: 09-25-2000, 09:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center