Show
Ignore:
Timestamp:
12/20/06 22:13:29 (7 years ago)
Author:
robert
Message:

Further work osgViewer::Viewer and related classes.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgcamera/osgcamera.cpp

    r5824 r5832  
    2929#include <osgViewer/Viewer> 
    3030 
     31#include <osgGA/TrackballManipulator> 
     32 
    3133void renderCamera(osg::Camera* camera) 
    3234{ 
    3335    osg::GraphicsContext* gc = camera->getGraphicsContext(); 
    3436    if (!gc) return; 
     37     
     38#if 0     
     39    osgViewer::GraphicsWindowX11* gwX11 =  dynamic_cast<osgViewer::GraphicsWindowX11*>(gc); 
     40    if (gwX11) 
     41    { 
     42        gwX11->checkEvents(); 
     43 
     44        osgGA::EventQueue::Events events; 
     45        if (gwX11->getEventQueue()->takeEvents(events)) 
     46        { 
     47        } 
     48    } 
     49#endif 
    3550     
    3651    osgUtil::SceneView* sceneView = dynamic_cast<osgUtil::SceneView*>(camera->getRenderingCache(0)); 
     
    7893 
    7994    osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer; 
     95    viewer->setSceneData(loadedModel.get()); 
     96    viewer->setCameraManipulator(new osgGA::TrackballManipulator()); 
    8097    viewer->setUpViewAcrossAllScreens(); 
    8198    viewer->realize(); 
     
    114131        loadedModel->accept(updateVisitor); 
    115132 
    116  
    117         viewer->getCamera()->setViewMatrix(viewMatrix); 
    118  
    119         viewer->updateSlaves(); 
     133        viewer->frameAdvance(); 
     134        viewer->frameEventTraversal(); 
     135        viewer->frameUpdateTraversal(); 
     136 
     137        // viewer->getCamera()->setViewMatrix(viewMatrix); 
     138 
    120139 
    121140        if (viewer->getCamera() && viewer->getCamera()->getGraphicsContext()) renderCamera(viewer->getCamera());