[Lazarus] Fast drawing to canvas

Sven Barth pascaldragon at googlemail.com
Fri Feb 10 11:46:23 CET 2012


Am 10.02.2012 11:34, schrieb dhkblaszyk at zeelandnet.nl:
> Hi Sven,
>
> I just comitted a second version, which is also based on a "simple
> image" as you put it. At 50% HD I get 88fps on windows and 19fps on Mac.
> Couldn't test on Linux as that machine refuses to work properly. I have
> not used OpenGL but TImage instead. In other tests I have never seen any
> actual speed improvements of OpenGL over a native canvas, unless you
> create memory textures and can utilize the hardware acceleration.

At least on Windows that sounds like a nice improvement (though not 
necessarily perfect ^^).

> The reason to stream directly form disk is that if I would like to
> display a longer list of images I will not be able to store them in
> memory. Say I have a movie clip @ 24fps for 60sec. This would require
> (50%HD) 24 * 60 * 1.5 = 2GB of memory. What if I would like to display
> 10min? No chance... Please note that I really need the full resolution
> images here, so converting to jpeg to reduce memory footprint is out of
> the question. Implementing a memory cache is also on my list, but when
> playing the entire loop from start to end this will not help as each
> frame is displayed only once of course.

That's a valid reason, but I removed the disk cache to test pure drawing 
performance.

> In the "fast" version I stream data from a png and this is actually
> pretty fast now. However I will implement native loading of the images
> to optimize the process. But this is only optionally as my issue is not
> with the setup of the file cache but more with the drawing speed. As
> said, on windows I get 50%HD @ 88fps and full HD @35fps. Now Mac is
> worrying as it draws full HD @ only 12fps. Maybe opengl can draw more
> efficienctly in this case? I would also like to test SDL.

I don't know whether OpenGL is really more efficiently, I just wanted to 
throw in an alternative variant.

Regards,
Sven




More information about the Lazarus mailing list