initGLWidgetAndViewer

 

void initGLWidgetAndViewer()
{
    osgViewer::ViewerBase::ThreadingModel threadingModel = osgViewer::ViewerBase::SingleThreaded;
    IfcSystem* m_system->getRootNode()->setCullingActive( false );
    osg::ref_ptr<VCGraphicsWindowQt> m_graphics_window = new GraphicsWindowQt( this );
    QtOSGWidget* opengl_widget = m_graphics_window->getOpenGLWidget();
    opengl_widget->setMinimumSize( QSize( 150, 150 ) );
    osg::ref_ptr<osgViewer::View> m_main_view = opengl_widget->getView();
    m_main_view->setSceneData( m_system->getRootNode() );
    osg::ref_ptr<osgViewer::CompositeViewer> m_composite_viewer = opengl_widget->getViewer();
    m_composite_viewer->setThreadingModel( threadingModel );
    m_composite_viewer->setKeyEventSetsDone( 0 );        // disable the default setting of viewer.done() by pressing Escape.
    m_composite_viewer->addView( m_main_view );

    // set up the camera
    osg::ref_ptr<osg::Camera> camera = m_main_view->getCamera();
    camera->setGraphicsContext( m_graphics_window );
    camera->setClearColor( osg::Vec4f( 0.92, 0.93, 0.94, 1.0 ) );
    camera->setComputeNearFarMode( osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR );

    if( m_main_view )
    {
        m_main_view->setCameraManipulator( m_camera_manipulator );
        m_main_view->setSceneData( m_system->getRootNode() );
    }
}

 

posted @ 2019-07-26 13:12  西北逍遥  阅读(316)  评论(0编辑  收藏  举报