Free Pascal Fast Bitmaps (Part 3)

I have now made public my repository for the test application mentioned in part 2.  This contains the core CompactImage class and two rendering units.  The first is for LCL applications.  This contains platform specific code to render the buffers to a LCL canvas.  This will achieve better frame rates on Windows, Linux and Mac OSX than using the TCanvas Draw method.  The improvement is best on Windows where I am getting a minimum of around 60fps on all of the machines I have tried.  My Kubuntu Laptop achieves around 30fps and the worst performing is my MacBook Pro which struggles to reach 20fps, although this is still twice as fast as the vanilla LCL.


The second rendering unit is an experimental OpenGL implementation.  It’s performance is much better than the LCL renderer.  It will vary depending upon the hardware and drivers in use, but again, on my laptop this is achieving over 80fps.  I have noticed it occasionally hangs the program on termination, so I won’t be using this in production yet.  Also the image transfer is achieved through glDrawPixels which I gather is now depreciated in the OpenGL API, so I will be researching a modern alternative implementation to replace this.

Lastly, the font rendering for the frame count is provided by a third unit that is a wrapper for the FreeType version 1 Pascal source code, which can render text directly into the image buffer by scan-lines.  All of these units are in an experimental state, and they will need considerable testing and extending before being usable in finished applications.  However, as a proof of concept they are very encouraging.  The code repository can be found here:

Leave a Reply