// CC -o Hello texture.C -lInventorXt -lInventor -lm -lmalloc_cv #include #include #include #include #include #include #include #include #include main(int , char **argv) { Widget myWindow = SoXt::init(argv[0]); if(myWindow == NULL) exit(1); SoSeparator *root = new SoSeparator; root->ref(); // Choose a texture SoTexture2 *rock = new SoTexture2; // root->addChild(new SoCone); root->addChild(rock); rock->filename.setValue("uandp.rgb"); // Make a cube root->addChild(new SoCone); SoXtExaminerViewer *myViewer = new SoXtExaminerViewer(myWindow); myViewer->setSceneGraph(root); myViewer->setTitle("Default Texture Coords"); myViewer->show(); //Writing inventor data to ascii file SoWriteAction *myAction = new SoWriteAction; myAction->getOutput()->openFile("uandp.iv"); myAction->getOutput()->setBinary(FALSE); myAction->apply(root); myAction->getOutput()->closeFile(); delete myAction; SoXt::show(myWindow); SoXt::mainLoop(); }