Jump to content
  • Advertisement
Sign in to follow this  
DrEvil

rendering over game with gdi

This topic is 3612 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working on a server plugin for a few commercial games in which I would like to render some various information over the top of the game in the same window. I would like to use GDI+ for this, as it is simple to get the HWND of the game with GetActiveWindow(), then GetDC(), and this allows me to render on top of OpenGL and DirecX games with the same methods(DrawText etc). The problem with this method is that the resulting rendering flickers pretty badly, because the server plugin where I am doing this is typically running a a much slower framerate than the games rendering. Anyone know how I can fix this flicker? Presumably I could hook the OpenGL and DirectX swapbuffer calls somehow, but I'm not sure how to do this, and I'm hoping there is a less 'hacky' way. Any thoughts are appreciated, or any information about hooking functions like this would be appreciated as well, so I can do my rendering at the same rate that the game does to get rid of the flicker.

Share this post


Link to post
Share on other sites
Advertisement
Yep, flickering is a big problem with doing this in GDI.

I did this in Quake a while back. I created a DLL that did all the drawing. Found the function that draws the world (easy if you set a breakpoint on r_drawworld), and when it was done, I just jmp'd to my function, then jumped back.

Ugly, and VERY hackish, but it worked.

You may want to either hook the renderer for a more proper way, or even try a DirectDraw overlay.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!