[osg-users] [forum] Saving scene object to .obj file

Martin Varsa nabordelaspam at centrum.cz
Sat Apr 23 06:36:17 PDT 2011


Hi,

I'd like to know if there is possibility to write geometry of objects to file for later use in 3D editor? I work on project where I create objects in virtual reality engine (it uses osg). So I'd like to save these created object do .obj or other file for use in 3D editor.

I've tried this: 

Code:

osg::ref_ptr<osg::Sphere> sphere = new osg::Sphere(osg::Vec3f(0,0,0), 1.0);
osg::ref_ptr<osg::ShapeDrawable> sphereShape = new osg::ShapeDrawable(sphere);
sphereShape->setUseDisplayList(false);


if( osgDB::writeObjectFile(sphereShape.get(), "testfile.obj") ){
 cout << "uspesne zapsano do souboru" << endl;
} else {
 cout << "cyhba pri zapisu do souboru" << endl;
}



but without success.

Thank you a lot!

Cheers,
Martin

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=38751#38751








More information about the osg-users mailing list