void init(int argc, char *argv[]) { osgInit(argc, argv); int winId = setupGLUT(&argc, argv); GLUTWindowUnrecPtr gwin = GLUTWindow::create(); gwin->setGlutId(winId); gwin->init ( ); cubes = Cubes::create(); cubesN = makeNodeFor(cubes); cubes->setMaterial(getDefaultMaterial()); for(UInt32 i = 0; i < 10; ++i) { cubes->editMFPosition()->push_back( Pnt3f (random(-2.f, 2.f), random(-2.f, 2.f), random(-2.f, 2.f))); cubes->editMFLength ()->push_back(random(0.5f, 2.f)); cubes->editMFColor ()->push_back( Color3f(random(0.5f, 1.f), random(0.5f, 1.f), random(0.5f, 1.f))); } mgr = new SimpleSceneManager; mgr->setWindow(gwin ); mgr->setRoot (cubesN); mgr->showAll(); commitChanges(); }
void init(int argc, char *argv[]) { int winId = setupGLUT(&argc, argv); GLUTWindowUnrecPtr gwin = GLUTWindow::create(); gwin->setGlutId(winId); gwin->init ( ); NodeUnrecPtr scene = buildScene(); mgr = SimpleSceneManager::create(); mgr->setWindow(gwin ); mgr->setRoot (scene); FrameHandler::the()->init(); mgr->showAll(); }