int main(int argc, char **argv)
{
    // OSG init
    osgInit(argc,argv);

    {
        // Set up Window
        WindowEventProducerRecPtr TutorialWindow = createNativeWindow();
        TutorialWindow->initWindow();

        // Create the SimpleSceneManager helper
        SimpleSceneManager sceneManager;
        TutorialWindow->setDisplayCallback(boost::bind(display, &sceneManager));
        TutorialWindow->setReshapeCallback(boost::bind(reshape, _1, &sceneManager));

        // Tell the Manager what to manage
        sceneManager.setWindow(TutorialWindow);

        TutorialWindow->connectMousePressed(boost::bind(mousePressed, _1, &sceneManager));
        TutorialWindow->connectMouseReleased(boost::bind(mouseReleased, _1, &sceneManager));
        TutorialWindow->connectMouseDragged(boost::bind(mouseDragged, _1, &sceneManager));
        TutorialWindow->connectMouseWheelMoved(boost::bind(mouseWheelMoved, _1, &sceneManager));
        TutorialWindow->connectKeyTyped(boost::bind(keyPressed, _1));

        // Make Main Scene Node
        NodeRecPtr Scene = makeCoredNode<Group>();
        
        NodeRecPtr TorusNode  = createTorus();
        NodeRecPtr SphereNode = createSphere();
        NodeRecPtr ConeNode   = createCone();
        NodeRecPtr BoxNode    = createBox();

        Scene->addChild(TorusNode);
        Scene->addChild(SphereNode);
        Scene->addChild(ConeNode);
        Scene->addChild(BoxNode);

        // Create the Graphics
        GraphicsRecPtr TutorialGraphics = Graphics2D::create();

        // Initialize the LookAndFeelManager to enable default settings
        LookAndFeelManager::the()->getLookAndFeel()->init();


        /******************************************************

          Create a Background

         ******************************************************/
        ColorLayerRecPtr GreyBackground = ColorLayer::create();

        GreyBackground->setColor(Color4f(.93,.93,.93,1.0));


        /******************************************************

          Create some Borders

         ******************************************************/
        LineBorderRecPtr PanelBorder = LineBorder::create();
        EmptyBorderRecPtr Panel1Border = EmptyBorder::create();
        EmptyBorderRecPtr Panel2Border = EmptyBorder::create();
        EmptyBorderRecPtr emptyBorder = EmptyBorder::create();

        PanelBorder->setColor(Color4f(0.0,0.0,0.0,1.0));
        PanelBorder->setWidth(1);

        Panel1Border->setTopWidth(0);
        Panel1Border->setBottomWidth(6);
        Panel1Border->setLeftWidth(0);
        Panel1Border->setRightWidth(0);
        Panel2Border->setTopWidth(0);
        Panel2Border->setBottomWidth(0);
        Panel2Border->setLeftWidth(0);
        Panel2Border->setRightWidth(0);


        /******************************************************

          Create some Labels and stuff to go 
          with them

         ******************************************************/
        LabelRecPtr LeftPanelLabel1 = Label::create();
        UIFontRecPtr LeftPanelLabel1Font = UIFont::create();

        LeftPanelLabel1Font->setSize(50);

        LeftPanelLabel1->setBorders(emptyBorder);
        LeftPanelLabel1->setBackgrounds(GreyBackground);
        LeftPanelLabel1->setFont(LeftPanelLabel1Font);
        LeftPanelLabel1->setText("OSG Gui");
        LeftPanelLabel1->setPreferredSize(Vec2f(300, 100));
        LeftPanelLabel1->setAlignment(Vec2f(0.0f, 0.5f));

        /******************************************************

          Create some Layouts

         ******************************************************/
        BoxLayoutRecPtr MainInternalWindowLayout = BoxLayout::create();
        FlowLayoutRecPtr LeftPanelLayout = FlowLayout::create();
        BoxLayoutRecPtr RightPanelLayout = BoxLayout::create();
        MainInternalWindowLayout->setOrientation(BoxLayout::HORIZONTAL_ORIENTATION);

        LeftPanelLayout->setOrientation(FlowLayout::HORIZONTAL_ORIENTATION);
        LeftPanelLayout->setMinorAxisAlignment(1.0f);

        RightPanelLayout->setOrientation(BoxLayout::VERTICAL_ORIENTATION);


        /******************************************************

          Create MainFrame and Panels

         ******************************************************/
        PanelRecPtr LeftPanel = Panel::createEmpty();
        PanelRecPtr RightPanel = Panel::createEmpty();

        // LeftPanel stuff
        LeftPanel->setPreferredSize(Vec2f(400, 500));
        LeftPanel->pushToChildren(LeftPanelLabel1);
        PanelRecPtr LeftPanelButtonPanel = createLeftPanelButtonPanel();
        LeftPanel->pushToChildren(LeftPanelButtonPanel);
        PanelRecPtr LeftPanelRadioTextPanel = createLeftPanelRadioTextPanel();
        LeftPanel->pushToChildren(LeftPanelRadioTextPanel);
        LeftPanel->setLayout(LeftPanelLayout);
        LeftPanel->setBackgrounds(GreyBackground);
        LeftPanel->setBorders(Panel1Border);

        //RightPanel stuff
        RightPanel->setPreferredSize(Vec2f(200, 620));
        PanelRecPtr RightPanelButtonPanel = createRightPanelButtonPanel();
        RightPanel->pushToChildren(RightPanelButtonPanel);
        PanelRecPtr RightPanelCheckPanel = createRightPanelCheckPanel(TorusNode,
                                                                      SphereNode,
                                                                      ConeNode,  
                                                                      BoxNode);  
        RightPanel->pushToChildren(RightPanelCheckPanel);
        RightPanel->setLayout(RightPanelLayout);
        RightPanel->setBackgrounds(GreyBackground);
        RightPanel->setBorders(Panel2Border);

        // Create The Main InternalWindow
        InternalWindowRecPtr MainInternalWindow = InternalWindow::create();
        MainInternalWindow->pushToChildren(LeftPanel);
        MainInternalWindow->pushToChildren(RightPanel);
        MainInternalWindow->setLayout(MainInternalWindowLayout);
        MainInternalWindow->setBackgrounds(GreyBackground);
        MainInternalWindow->setBorders(PanelBorder);
        MainInternalWindow->setAlignmentInDrawingSurface(Vec2f(0.5f,0.5f));
        MainInternalWindow->setScalingInDrawingSurface(Vec2f(1.0f,1.0f));
        MainInternalWindow->setDrawTitlebar(false);
        MainInternalWindow->setResizable(false);
        //MainInternalWindow->setOpacity(0.7f);

        // Create the Drawing Surface
        UIDrawingSurfaceRecPtr TutorialDrawingSurface = UIDrawingSurface::create();
        TutorialDrawingSurface->setGraphics(TutorialGraphics);
        TutorialDrawingSurface->setEventProducer(TutorialWindow);

        TutorialDrawingSurface->openWindow(MainInternalWindow);

        // Make A 3D Rectangle to draw the UI on
        UIRectangleRecPtr UIRectCore = UIRectangle::create();
        UIRectCore->setPoint(Pnt3f(-310.0,-310.0,370.0));
        UIRectCore->setWidth(620);
        UIRectCore->setHeight(620);
        UIRectCore->setDrawingSurface(TutorialDrawingSurface);

        NodeRecPtr UIRectNode = Node::create();
        UIRectNode->setCore(UIRectCore);

        // add the UIRect as a child
        Scene->addChild(UIRectNode);


        sceneManager.setRoot(Scene);

        // Show the whole Scene
        sceneManager.showAll();

        //Create the Documentation Foreground and add it to the viewport
        SimpleScreenDoc TheSimpleScreenDoc(&sceneManager, TutorialWindow);

        //Open Window
        Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f);
        Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5);
        TutorialWindow->openWindow(WinPos,
                                   WinSize,
                                   "21ExampleInterface");

        //Enter main Loop
        TutorialWindow->mainLoop();
    }

    osgExit();

    return 0;
}
int main(int argc, char **argv)
{
    // OSG init
    osgInit(argc,argv);

    // Set up Window
    TutorialWindow = createNativeWindow();
    TutorialWindow->initWindow();

    TutorialWindow->setDisplayCallback(display);
    TutorialWindow->setReshapeCallback(reshape);

    TutorialMouseListener mouseListener;
    TutorialMouseMotionListener mouseMotionListener;
    TutorialWindow->addMouseListener(&mouseListener);
    TutorialWindow->addMouseMotionListener(&mouseMotionListener);

    TutorialKeyListener TheKeyListener;
    TutorialWindow->addKeyListener(&TheKeyListener);

    // Create the SimpleSceneManager helper
    mgr = new SimpleSceneManager;

    // Tell the Manager what to manage
    mgr->setWindow(TutorialWindow);

    // Set up Window

	//Load in File
	NodeRefPtr LoadedFile = SceneFileHandler::the()->read("C:\\Documents and Settings\\All Users\\Documents\\Cell.osb");

    // Make Main Scene Node
    create3DObjects();
    scene = OSG::Node::create();
        scene->setCore(OSG::Group::create());
		scene->addChild(LoadedFile);

    // Create the Graphics
    GraphicsRefPtr TutorialGraphics = OSG::Graphics2D::create();

    // Initialize the LookAndFeelManager to enable default settings
    LookAndFeelManager::the()->getLookAndFeel()->init();

        
    /******************************************************
            
            Create a Background

    ******************************************************/
    ColorLayerRefPtr GreyBackground = OSG::ColorLayer::create();

        GreyBackground->setColor(Color4f(.93,.93,.93,1.0));


    /******************************************************
            
            Create some Borders

    ******************************************************/
    LineBorderRefPtr PanelBorder = OSG::LineBorder::create();
    EmptyBorderRefPtr Panel1Border = OSG::EmptyBorder::create();
    EmptyBorderRefPtr Panel2Border = OSG::EmptyBorder::create();
    EmptyBorderRefPtr emptyBorder = OSG::EmptyBorder::create();
    
        PanelBorder->setColor(Color4f(0.0,0.0,0.0,1.0));
        PanelBorder->setWidth(1);

        Panel1Border->setTopWidth(0);
        Panel1Border->setBottomWidth(6);
        Panel1Border->setLeftWidth(0);
        Panel1Border->setRightWidth(0);
        Panel2Border->setTopWidth(0);
        Panel2Border->setBottomWidth(0);
        Panel2Border->setLeftWidth(0);
        Panel2Border->setRightWidth(0);
    

    /******************************************************

            Create some Labels and stuff to go 
            with them

    ******************************************************/
    LabelRefPtr LeftPanelLabel1 = OSG::Label::create();
    UIFontRefPtr LeftPanelLabel1Font = OSG::UIFont::create();

        LeftPanelLabel1Font->setSize(50);

        LeftPanelLabel1->setBorders(emptyBorder);
        LeftPanelLabel1->setBackgrounds(GreyBackground);
        LeftPanelLabel1->setFont(LeftPanelLabel1Font);
        LeftPanelLabel1->setText("OSG Gui");
        LeftPanelLabel1->setPreferredSize(Vec2f(300, 100));
		LeftPanelLabel1->setAlignment(Vec2f(0.0f, 0.5f));

     /******************************************************

            Create some Layouts

    ******************************************************/
    BoxLayoutRefPtr MainInternalWindowLayout = OSG::BoxLayout::create();
    FlowLayoutRefPtr LeftPanelLayout = OSG::FlowLayout::create();
    BoxLayoutRefPtr RightPanelLayout = OSG::BoxLayout::create();
        MainInternalWindowLayout->setOrientation(BoxLayout::HORIZONTAL_ORIENTATION);

        LeftPanelLayout->setOrientation(FlowLayout::HORIZONTAL_ORIENTATION);
        LeftPanelLayout->setMinorAxisAlignment(1.0f);

        RightPanelLayout->setOrientation(BoxLayout::VERTICAL_ORIENTATION);
    

    /******************************************************

        Create MainFrame and Panels

    ******************************************************/
    PanelRefPtr LeftPanel = OSG::Panel::create();
    PanelRefPtr RightPanel = OSG::Panel::create();

    // LeftPanel stuff
        LeftPanel->setPreferredSize(Vec2f(400, 500));
        LeftPanel->pushToChildren(LeftPanelLabel1);
        LeftPanel->pushToChildren(createLeftPanelButtonPanel());
        LeftPanel->pushToChildren(createLeftPanelRadioTextPanel());
        LeftPanel->setLayout(LeftPanelLayout);
        LeftPanel->setBackgrounds(GreyBackground);
        LeftPanel->setBorders(Panel1Border);

    //RightPanel stuff
        RightPanel->setPreferredSize(Vec2f(200, 620));
        RightPanel->pushToChildren(createRightPanelButtonPanel());
        RightPanel->pushToChildren(createRightPanelCheckPanel());
        RightPanel->setLayout(RightPanelLayout);
        RightPanel->setBackgrounds(GreyBackground);
        RightPanel->setBorders(Panel2Border);
    
    // Create The Main InternalWindow
    InternalWindowRefPtr MainInternalWindow = OSG::InternalWindow::create();
       MainInternalWindow->pushToChildren(LeftPanel);
       MainInternalWindow->pushToChildren(RightPanel);
       MainInternalWindow->setLayout(MainInternalWindowLayout);
       MainInternalWindow->setBackgrounds(GreyBackground);
       MainInternalWindow->setBorders(PanelBorder);
	   MainInternalWindow->setAlignmentInDrawingSurface(Vec2f(0.5f,0.5f));
	   MainInternalWindow->setScalingInDrawingSurface(Vec2f(1.0f,1.0f));
	   MainInternalWindow->setDrawTitlebar(false);
	   MainInternalWindow->setResizable(false);

    // Create the Drawing Surface
    UIDrawingSurfaceRefPtr TutorialDrawingSurface = UIDrawingSurface::create();
        TutorialDrawingSurface->setGraphics(TutorialGraphics);
        TutorialDrawingSurface->setEventProducer(TutorialWindow);
    
	TutorialDrawingSurface->openWindow(MainInternalWindow);

    // Make A 3D Rectangle to draw the UI on
    UIRectangleRefPtr UIRectCore = UIRectangle::create();
        UIRectCore->setPoint(Pnt3f(-310.0,-310.0,370.0));
        UIRectCore->setWidth(620);
        UIRectCore->setHeight(620);
        UIRectCore->setDrawingSurface(TutorialDrawingSurface);
    
    NodeRefPtr UIRectNode = OSG::Node::create();
        UIRectNode->setCore(UIRectCore);
    
        // add the UIRect as a child
        scene->addChild(UIRectNode);


    mgr->setRoot(scene);

    // Show the whole Scene
    mgr->showAll();

    //Open Window
    Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f);
    Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5);
    TutorialWindow->openWindow(WinPos,
            WinSize,
            "21ExampleInterface");

    //Enter main Loop
    TutorialWindow->mainLoop();

    osgExit();

    return 0;
}