X Error of failed request: GLXBadDrawable

Looks like drawing error.
Try to disable on-screen drawing of the test scene to test that.
Someone using this code told me he had to update it to match VTK changes, but did not share results. May be some primitives I used in the test scene are obsolete or broken now.

If you are interested in 3D VTK export using FOSS tools and have time and knowledge of VTK necessary for co-developing/testing it, I can revisit the issue.
I do not use VTK now and make 3D PDFs with other tools.