This repository contains the code of a dynamic library using Castle Game Engine to load, render and interact with models in any format supported by Castle Game Engine (like X3D, VRML, glTF).
This repository also contains the precompiled library (DLL, SO etc.) made using GitHub Actions.
The library exposes API in plain C (and is thus useful from any programming language), and is available for all platforms supported by Castle Game Engine (Windows, Linux, macOS, iOS...). It is used "in production" by the Room Arranger for the 3D viewer on multiple platforms.
The library allows to load and render models in an application written in any programming language (C, C++, C#, Python, ...) and display the results using any technology. You initialize OpenGL(ES) context on your side, in any way, and then call library routines to render models and interact with them.
Note for Pascal developers: You should not use this library, in short :) Instead use full Castle Game Engine API in Pascal, which is much more powerful (can manage any number of scenes, transformations, creatures, viewports, lights, user interface, physics, sound and more). This library is designed for a more limited purpose: load and render a single model at a time.

Multi window Qt Library Tester in C++
Enter this directory, and run ./castleengine_compile.sh shell script.
This should produce castleengine.dll (on Windows), libcastleengine.dylib (on macOS) or libcastleengine.so (on Unix).
To compile static library for iOS, run ./compile-iOS.sh shell script.
Note for Windows: castleengine_compile.sh requires you to have Cygwin or MinGW installed. It may be easier to call castleengine_compile.bat, which doesn't require anything special.
Note: Make sure that fpc binary is available on the environment variable $PATH. If you don't know how to set the environment variable, search the Internet (e.g. these are quick instructions how to do it on various Windows versions).
When using under LGPL license, remember to add --compiler-option=-dCASTLE_ENGINE_LGPL parameter.
-
castleengine.lpr: the only source code file with all the library code
-
castleengine.h: header file with the API.
-
castlelib_c_loader.cpp: helper C++ file to load the library dynamically. Contains code for multiplatform Qt and Windows
-
engine examples have various example projects using the library.
- add
castleengine.handcastlelib_c_loader.cppto your project source files - provide the compiled library
castleengine.dll/.dylib/.sonext to your exe file
- add
castleengine.handtremolosources to your project source files. - add Pod file with
freetypedependency. Install pods and use xcworkspace to open the project. Alternatively, compile Freetype as static library (freetype.a) separately and just link with it - link with
libcastleengine.a