#include <Inventor/Win/SoWin.h> #include <Inventor/Win/viewers/SoWinExaminerViewer.h> #include <Inventor/nodekits/SoShapeKit.h> #include <Inventor/nodes/SoSeparator.h> #include <Inventor/nodes/SoCube.h> int main(int argc, char ** argv) { HWND window = SoWin::init(argv[0]); SoWinExaminerViewer * viewer = new SoWinExaminerViewer(window); // Instantiating a shape kit, by default creating a simple sphere. SoShapeKit * shapekit = new SoShapeKit; // Swapping the sphere with a cube. shapekit->setPart("shape", new SoCube); // Setting the cube to be rendered in the color red. The shape kit // has a SoAppearanceKit as one of it's parts. The "material" part // used to set the color of the shape, really belongs the // appearance kit. If the SoShapeKit::set() is used, it will // check if some of its sub kits has a part with the name given, // and delegate the setting to the correct kit. shapekit->set("material", "diffuseColor 1 0 0"); SoSeparator * newroot = new SoSeparator; newroot->ref(); newroot->addChild(shapekit); viewer->setSceneGraph(newroot); viewer->show(); SoWin::show(window); SoWin::mainLoop(); delete viewer; newroot->unref(); return 0; }