问题
I was wondering if anyone knew of a program that can take a 3D drawing of an object and then convert it into the required OpenGL points and normals.
Basically I have an AutoCAD drawing of that I want to be able to display in a program I am creating for iPhone. Any suggestions?
回答1:
If you have AutoCAD itself, you could export the object into a mesh format, like STL. Reading STL files is straightforward.
If you don't have AutoCAD you may also try FreeCAD, which is based on OpenCascade, which exports quite nice meshes (also into STL format). However the AutoCAD file format is in constant flux, so YMMV when reading the original file.
回答2:
This is gonna be a bit of a downer, but DWG file formats explore a deep dark road I'm not sure even AutoDesk has control over. The format doesn't even belong to them (they bought it a while ago) and even if you could manage it, the format is updated every 3 years or so (and is set to update again soon). For now, they have all the power. Sorry.
All I can say, is explore the references and take a look here (no code, sorry)
来源:https://stackoverflow.com/questions/8277117/3d-cad-to-opengl