![]() |
![]() |
![]() |
Thanks to Michael van Canneyt, latest version of FPC 3.3.1 includes a great library to open and render SVG files: fcl-svg.
Now, you can use it to open SVG files in Castle Game Engine seamlessly:
- In the simplest case, you can just load and display SVG using TCastleScene, placed in a 2D viewport. Follow our viewport and scenes documentation, there’s nothing special for SVG there, you can just set
MyScene.Url := 'castle-data:/my.svg'now. -
SVG loaded this way remains “scalable”, which is naturally the normal state for our models. SVG paths and shapes are internally converted to shapes in X3D nodes.
-
We can render such model or save it back as X3D, STL, IFC (and soon glTF too).
Example showing how it works is in examples/images_videos/svg.
- As usual, we recommend to just download the latest engine and run the example from the installed engine sources.
-
In case of this demo, be sure to also install latest FPC 3.1.1 (e.g. using FpcUpDeluxe) and tell our editor to use it (in “Preferences -> FPC and Lazarus”) or tell our cli build tool to use it (by editing
$PATH).
The support is active automatically, if only you use the latest FPC 3.3.1 version. This is an unstable FPC, remember. You can install it easily using FpcUpDeluxe. Use it for daily development only after careful testing.
If you plan to use this feature for cross-platform applications, be aware that fcl-svg is not yet available on all platforms (according to its fpmake.pp). In particular, it doesn’t support web or Android. I’m sure FPC devs will be happy to test/add more platforms once they know this is really useful to you — just ping them (e.g. using the FPC mailing list or GitLab bugtracker), and offer help testing.
More details about SVG support here.
As always, we hope you enjoy using our engine and we’re grateful for your support on Patreon.
Moreover, consider supporting FPC and Lazarus developers by donating to the Free Pascal and Lazarus Foundation. They fund FPC/Lazarus open-source related projects, including lots of great work from Michael van Canneyt who implemented the SVG support on the FPC side.
Have fun making games!



Start the discussion at Castle Game Engine Forum