Some years ago I developed a very similar library , in the context of my PhD thesis. The library also used OpenGL for fast computation of virtual laser scanners on a 3D environment. These virtual scans were used as “expected measurements” and were compared with actual measurements for a particle filter map-based localization . The tool worked pretty well, and very fast, allowing to update hundreds of particles at rates of 5-10Hz.
I also developed the version for depth cameras, which I wanted to use later for camera-gripper calibration for robot manipulator applications, see picture below:
The main feature of this package, specially designed for 2D lidar simulation, was that the rendering window, which can be obviously hidden, was set with a size according to the resolution of the sensor you want to simulate, so no extra pixels are rendered. This resulted with very small windows to simulate lidars, since they typically have lower angular resolutions than cameras. Small rendering windows lead to fast renderings, so fast depth computations.
Just wanted to post here, so we can be in touch, and to point out two potential applications of this approach (mobile robot map-based localization and camera-hand calibration)
If I have some time I’ll try to dive a little bit in your code. Feel free to contact me for further discussion.
Math details about the library can be found in the SIMPAR’2010 publication:
Corominas Murtra, A., Trulls, E., Mirats Tur, J.M., Sanfeliu, A. Efficient Use of 3D Environment Models for Mobile Robot Simulation and Localization. Lecture Notes in Artificial Intelligence -LNAI6472. International Conference on Simulation, Modelling and Programming for Autonomous Robots (SIMPAR’10). Darmstadt, Germany. November 2010.