What library/program can draw molecules in 3D programmatically?
The "jmoldata" command (using JmolData.jar from Jmol) converts xyz/pdb and many other molecule formats to nicely rendered 3D images based on the user-provided Jmol scripts.

(answer based on the hint from the user @porphyrin)