Friday, March 7, 2014

OpenGL drawing in ROS rviz

At work we have a bunch of legacy OpenGL code from the pre-ROS era. Fortunately for us, there is a way to reuse it in rviz. Here is a gist showing how to do it:

Basically you setup your display to create a rendering queue and then push OpenGL code in it.

For instance, I had code that would create an OpenGL rendering list. I could use the exact same code to create the list, all I had to do was to let the rviz display use the list.

It's not super easy, mostly because the process is not well documented, but certainly easier than rewriting the whole thing in native OGRE code.The code provided in the gist definitely helps.

Besides, in that particular case, the OpenGL codes is stored in binary format (I guess it was created from some CAD drawing export tool).