#include #include #include #include #include #include int main(int argc, char** argv) { // Root node of the scene osg::ref_ptr root = new osg::Group; // Create the viewer osgViewer::Viewer viewer; viewer.setSceneData(root); viewer.realize(); // Add axesNode under root osg::ref_ptr axesNode = osgDB::readNodeFile("test.stl"); if (!axesNode) { printf("Origin node not loaded, model not found\n"); return 1; } root->addChild(axesNode); // Attach a manipulator (it's usually done for us when we use viewer.run()) osg::ref_ptr tm = new osgGA::TrackballManipulator; viewer.setCameraManipulator(tm); return viewer.run(); }