0

I've some problem with my Delphi (10.4) application, and I'm stuck for a few days now. So I hope someone can help me. I'm rewriting some old code.

Basically, I've a problem with BitBlt command and screen tearing.

My code is drawing some .bmp images (five images in five columns) on application main form (form is maximized). Resolution is 1920x1080 and screen is 27".

I prepare each .bmp image (each image is 300x900 px) in the background and then just BitBlt that .bmp to the main form canvas using BitBlt. I'm using 60 FPS. That is OK. My monitor refresh rate is 60 Hz.

But I'm seeing from time to time screen tearing.

I'm looking for a few days how to synchronize my BitBlt operations with sync but no luck.

I've read something about flip scree but that should be the same as BitBlt in the way I'm using it right now?

I've found some old posts to read HW port, WaitForVerticalBlank, move to OpnGL (that is not an option for me), ....

But I'm not able to solve this.

Thanks....

brane
  • 41
  • 6
  • It might be worth pointing out that `BitBlt` is part of the GDI, which is a graphics API from the late 1980s. It may not have been designed with flicker-free high-resolution 60 FPS animations in mind. – Andreas Rejbrand Feb 27 '23 at 14:10
  • You should also clarify exactly how you redraw your form. Typically, one `Invalidate`s the form and waits for the next `WM_PAINT`, but I suspect that you `BitBlt` outside of the paint handler? – Andreas Rejbrand Feb 27 '23 at 14:15
  • Regarding GDI, I'm aware that it is old but I can get 60 FPS. And yes BitBlt is outside of the paint handler. – brane Feb 27 '23 at 14:23
  • You can't draw outside the paint handler. Period. There are no exceptions. – Ken White Feb 28 '23 at 05:41

0 Answers0