Documentation
Requirements
Only Qt is required, nothing else. You can optionally use external libraries to extent functionality:
- libassimp: import arbitrary 3D models
- libmatio: export to Matlab .mat files
- libhdf5: export to .h5 files
- libgta: export to .gta files
First build and install libcamsim. Then compile and link your application against the installed version of libcamsim (not against the files in its build directories).
Usage
Libcamsim requires an OpenGL 4.5 core context. You should typically create such a context using an offscreen surface (see the examples).
If you want to display results in an interactive application, create another context that shares OpenGL objects with the libcamsim context, so that you can render the textures that libcamsim produces. If you do this, you might need to call glFinish() on the libcamsim context after calling simulate() to make sure the result textures are finished before reusing them in another OpenGL context, since there is no implicit synchronization between contexts.
If you want to use multiple GPUs, create offscreen contexts for each of them (this step is system dependent). Contexts on different GPUs cannot share objects, so each of these contexts must get its own scene and simulator instances. For example, if you import a model file, you must add its contents to all scene instances.
Note that the bottleneck is almost always the export, not the simulation itself! Export data without compression, and use a write-efficient file format! For example, simulating and exporting 125 floating point RGB frames of size 800x600 took the following time in seconds for different file formats, without compression: 1.5 (raw), 1.5 (gta), 4.9 (ppm), 7.0 (pfs), 7.0 (mat), 7.2 (png), 7.2 (h5), 118 (csv). Most of the time, it is a good idea to export .raw or .gta and postprocess / convert these results afterwards.
Library reference