flickering

Started by
2 comments, last by Muhammad Haggag 19 years, 3 months ago
I have a program which is utilizing DirectX9, I have another program which gets the DC of the DX9 program's window and draws to it, over whatever the DX9 surface is displaying. I get some flicker which is really really irritating and I'm wondering, is there any way to avoid this? At the moment I'm just drawing text with TextOut and LineTo to draw lines in a loop. Nothing fancy just drawing some trajectory lines of projectiles. Any help appreciated.
Advertisement
Hmm. Well, in general it's a bad idea to mix rendering API's like this. I don't know what language you're using, so I don't know the circumstances, but in Visual Basic I would disable AutoRedraw while I draw using the Win32 API, and then re-enable it afterward, prior to calling DoEvents. This usually solves flicker problems. . . but when you mix API's, it's really hard to predict what might happen. My advice: stick with DX9 for all output.

GDNet+. It's only $5 a month. You know you want it.

I'm using managed c++. It would be simple if I had the source to both programs, but I don't. One program was not developed by me. Is there any way I could access the display surface with D3D9 even if it's related to a device owned by another program?
Quote:Original post by TeknoMoose
I have a program which is utilizing DirectX9, I have another program which gets the DC of the DX9 program's window and draws to it, over whatever the DX9 surface is displaying. I get some flicker which is really really irritating and I'm wondering, is there any way to avoid this? At the moment I'm just drawing text with TextOut and LineTo to draw lines in a loop. Nothing fancy just drawing some trajectory lines of projectiles. Any help appreciated.

Basically, both APIs are fighting for the surface - each one draws over the other, giving you the horrible flicker. What you want to do can be achieved by providing a replacement d3d9.dll, where you replace some interface methods (e.g. IDirect3DDevice9::Present) with your own methods that do the additional magic. That way the 3rd party program uses your DLL, and you get to draw over its surface.

I think circlesoft's done something like this before, not sure how though. He's generally around, and hopefully he'll see this and elaborate with bits of uber-wisdom [grin]

This topic is closed to new replies.

Advertisement