I have a C/C++ MFC application where a moving image from left to right displays with StretchDIBits
in a window. And the screen tearing happens in the window.
Please understand I am not talking about flickering but screen tearing as flickering is more like whole screen blinking while screen tearing causes some scattering part of the image not synchronized when the image moves to right or left so that a moving vertical line temporarily looks broken one in a very short period of time.
At first, I thought StretchDIBits
was the cause but changing it to SetDIBitsToDevice didn't help at all. So I am suspecting it's GDI and googling about it supported my doubt.
I saw this article to fix the problem but it'd be cleaner to directly use DirectX in my opinion.
So at this point, I am thinking about using DirectX or OpenGL to prevent this tearing but not sure if this approach will work or if there is any better approach. So my question is
- Would going with OpenGL or DirectX solve this problem?
- Is there any better approach than going with OpenGL and DirectX?
Any clue will be appreciated.
To save time, please don't recommend not to use MFC as this is one of the requirements.