目前流程是:
osgViewer::viewBase:: frame()
{
viewerInit();[
//创建帧事件,并将漫游器与事件和视口相关联
-> osgViewer::Viewer::ViewerInit()
-> osgViewer::View::Init();
->(1)osgGA::EventQueue::createEvent();
(2)osgGA::MatrixManipulator::Init();
->(2.1)各种漫游器::init()
]
isRealized();[
//获取图形上下文数组。再遍历上下文数组,只要有一个准备好就Ok
-> osgViewer::Viewer::isRealized();
->(1)osgViewer::Viewer::getContexts().
->(1.1)osg::camera::getGraphicsContext()
->(1.2)osg::View::getNumSlaves()
->(1.3)osg::View::getSlave()
->(1.4)LessGraphicsContext()->osg::GraphicContext::getTraits()
->(2)osg::GraphicContext::isRealized()
->(2.1)->(1)
->(2.2)osg::GraphicsContext::isRealized()
->osg::GraphicsContext::isRealizedImplementation()
->(2.2.1)osgViewer::GraphicsWindow::isRealizedImplementation()
->(2.2.1.1)osgViewer:: GraphicsWindowWin32 ::isRealizedImplementation()
->(2.2.1.2) osgViewer::GraphicsWindowEmbedded ::isRealizedImplementation()
->(2.2.2)osgViewer::PixelBufferWin32::isRealizedImplementation()
-
]
realize(); [
//建立视口和相关的线程
->osgViewer::Viewer::realize()
->(1) osgViewer::Viewer::setCameraWithFocus()
->(2)osgViewer::Viewer::getContexts()
->(3)osgViewer::Viewer::readConfiguration()
->(3.1)osgDB::readObjectFile(const std::string& filename)
->(3.2)osgViewer::Viewer::take()
->(4)待续
]
advance(simulationTime);
eventTraversal();
updateTraversal();
renderingTraversals();
}
接下来进行读取数据
osgDB::readObjectFile(const std::string& filename)
这个函数的定义是
/** Read an osg::Object from file.
* Return valid osg::Object on success,
* return NULL on failure.
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
* for the filename extension, and this plugin then handles the request
* to read the specified file.*/
inline osg::Object* readObjectFile(const std::string& filename)
{
return readObjectFile(filename,Registry::instance()->getOptions());
}
通过注释也可以看出,这个是从文件名读取生成osg::Object,根据文件扩展名加载相应的读写插件,并根据插件读指定的文件。
至于具体如何,不急,慢慢来。每天一函数即可。
目前流程是:
osgViewer::viewBase:: frame()
{
viewerInit();[
//创建帧事件,并将漫游器与事件和视口相关联
-> osgViewer::Viewer::ViewerInit()
-> osgViewer::View::Init();
->(1)osgGA::EventQueue::createEvent();
(2)osgGA::MatrixManipulator::Init();
->(2.1)各种漫游器::init()
]
isRealized();[
//获取图形上下文数组。再遍历上下文数组,只要有一个准备好就Ok
-> osgViewer::Viewer::isRealized();
->(1)osgViewer::Viewer::getContexts().
->(1.1)osg::camera::getGraphicsContext()
->(1.2)osg::View::getNumSlaves()
->(1.3)osg::View::getSlave()
->(1.4)LessGraphicsContext()->osg::GraphicContext::getTraits()
->(2)osg::GraphicContext::isRealized()
->(2.1)->(1)
->(2.2)osg::GraphicsContext::isRealized()
->osg::GraphicsContext::isRealizedImplementation()
->(2.2.1)osgViewer::GraphicsWindow::isRealizedImplementation()
->(2.2.1.1)osgViewer:: GraphicsWindowWin32 ::isRealizedImplementation()
->(2.2.1.2) osgViewer::GraphicsWindowEmbedded ::isRealizedImplementation()
->(2.2.2)osgViewer::PixelBufferWin32::isRealizedImplementation()
-
]
realize(); [
//建立视口和相关的线程
->osgViewer::Viewer::realize()
->(1) osgViewer::Viewer::setCameraWithFocus()
->(2)osgViewer::Viewer::getContexts()
->(3)osgViewer::Viewer::readConfiguration()
->(3.1)osgDB::readObjectFile(const std::string& filename)
->(3.1.1)osg::Object* readObjectFile(const std::string& filename,const ReaderWriter::Options* options);
->(3.2)osgViewer::Viewer::take()
->(4)待续
]
advance(simulationTime);
eventTraversal();
updateTraversal();
renderingTraversals();
}