Take a look at Robin Kohli’s 3D engine at his website. You can draw 3d Shapes and save them right there. He has given download for the source as well.