Paul Toth has two different demos up that are good examples of how to build, animate, and render something using primitives in Delphi XE5 Firemonkey. The first demo was built to use low level OpenGL APIs directly and it actually loads the OpenGL library for each different platform and then does everything manually. It is a good example however of the power of Delphi to get at low level APIs and use them when you need to. The first demo supports Windows, OSX, and Android but not IOS (though support could be added). The first demo is 907 lines of code in it’s main file. You can download this demo here and it also includes binaries for each platform. Here is some sample code from that demo showing the import of the OpenGL libraries:

Delphi/Pascal

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

{$IFDEF Android}

const

OpenGL='/usr/lib/libGLESv1_CM.so';

Prefix='';

{$DEFINE CDECL}

{$ENDIF}

{$IFDEF MSWINDOWS}

const

OpenGL='OpenGL32.DLL';

{$DEFINE STDCALL}

{$ENDIF}

{$IFDEF MACOS}

const

OpenGL='/System/Library/Frameworks/OpenGL.framework/OpenGL';

Prefix='_';

{$DEFINE CDECL}

{$ENDIF}

The second demo that he built does pretty much the same thing except it was built entirely out of TRoundCube primitives and animated with TFrameAnimation using the Delphi XE5 visual editor. There is not a single low level API called that had to be written because Firemonkey took care of it all behind the scenes. The main project file for the second demo is 84 lines of code (or about a 90% reduction of code from the first project). The second demo I am assuming runs on Windows, Android, IOS, and OSX out of the box because it is just Firemonkey. You can download the second demo here.

How much more can you get done in a day when you can write ~90% less code to accomplish the same goal? These two projects are a perfect example of why the component based culture of Delphi Firemonkey is a force multiplier for cross platform development on the desktop and mobile devices.