本文整理汇总了C++中Contexts::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Contexts::push_back方法的具体用法?C++ Contexts::push_back怎么用?C++ Contexts::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contexts
的用法示例。
在下文中一共展示了Contexts::push_back方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addView
void CompositeViewer::addView(osgViewer::View* view)
{
if (!view) return;
bool alreadyRealized = isRealized();
bool threadsWereRunning = _threadsRunning;
if (threadsWereRunning) stopThreading();
_views.push_back(view);
view->_viewerBase = this;
if (view->getSceneData())
{
// make sure that existing scene graph objects are allocated with thread safe ref/unref
if (getThreadingModel()!=ViewerBase::SingleThreaded)
{
view->getSceneData()->setThreadSafeRefUnref(true);
}
// update the scene graph so that it has enough GL object buffer memory for the graphics contexts that will be using it.
view->getSceneData()->resizeGLObjectBuffers(osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts());
}
view->setFrameStamp(_frameStamp.get());
if (alreadyRealized)
{
Contexts contexts;
if (view->getCamera()->getGraphicsContext())
{
contexts.push_back(view->getCamera()->getGraphicsContext());
}
for(unsigned int i=0; i<view->getNumSlaves(); ++i)
{
if (view->getSlave(i)._camera->getGraphicsContext())
{
contexts.push_back(view->getSlave(i)._camera->getGraphicsContext());
}
}
for(Contexts::iterator itr = contexts.begin();
itr != contexts.end();
++itr)
{
if (!((*itr)->isRealized()))
{
(*itr)->realize();
}
}
}
if (threadsWereRunning) startThreading();
}
示例2: addView
void CompositeViewer::addView(osgViewer::View* view)
{
bool alreadyRealized = isRealized();
bool threadsWereRuinning = _threadsRunning;
if (threadsWereRuinning) stopThreading();
_views.push_back(view);
view->_viewerBase = this;
view->setFrameStamp(_frameStamp.get());
if (alreadyRealized)
{
Contexts contexts;
if (view->getCamera()->getGraphicsContext())
{
contexts.push_back(view->getCamera()->getGraphicsContext());
}
for(unsigned int i=0; i<view->getNumSlaves(); ++i)
{
if (view->getSlave(i)._camera->getGraphicsContext())
{
contexts.push_back(view->getSlave(i)._camera->getGraphicsContext());
}
}
for(Contexts::iterator itr = contexts.begin();
itr != contexts.end();
++itr)
{
if (!((*itr)->isRealized()))
{
(*itr)->realize();
}
}
}
if (threadsWereRuinning) startThreading();
}
示例3: getContexts
void CompositeViewer::getContexts(Contexts& contexts, bool onlyValid)
{
typedef std::set<osg::GraphicsContext*> ContextSet;
ContextSet contextSet;
contexts.clear();
for(RefViews::iterator vitr = _views.begin();
vitr != _views.end();
++vitr)
{
osgViewer::View* view = vitr->get();
osg::GraphicsContext* gc = view->getCamera() ? view->getCamera()->getGraphicsContext() : 0;
if (gc && (gc->valid() || !onlyValid))
{
if (contextSet.count(gc)==0)
{
contextSet.insert(gc);
contexts.push_back(gc);
}
}
for(unsigned int i=0; i<view->getNumSlaves(); ++i)
{
View::Slave& slave = view->getSlave(i);
osg::GraphicsContext* sgc = slave._camera.valid() ? slave._camera->getGraphicsContext() : 0;
if (sgc && (sgc->valid() || !onlyValid))
{
if (contextSet.count(sgc)==0)
{
contextSet.insert(sgc);
contexts.push_back(sgc);
}
}
}
}
}
示例4: getContexts
void CompositeViewer::getContexts(Contexts& contexts, bool onlyValid)
{
typedef std::set<osg::GraphicsContext*> ContextSet;
ContextSet contextSet;
for(RefViews::iterator vitr = _views.begin();
vitr != _views.end();
++vitr)
{
osgViewer::View* view = vitr->get();
if (view->getCamera() &&
view->getCamera()->getGraphicsContext() &&
(view->getCamera()->getGraphicsContext()->valid() || !onlyValid))
{
contextSet.insert(view->getCamera()->getGraphicsContext());
}
for(unsigned int i=0; i<view->getNumSlaves(); ++i)
{
View::Slave& slave = view->getSlave(i);
if (slave._camera.valid() &&
slave._camera->getGraphicsContext() &&
(slave._camera->getGraphicsContext()->valid() || !onlyValid))
{
contextSet.insert(slave._camera->getGraphicsContext());
}
}
}
contexts.clear();
contexts.reserve(contextSet.size());
for(ContextSet::iterator itr = contextSet.begin();
itr != contextSet.end();
++itr)
{
contexts.push_back(const_cast<osg::GraphicsContext*>(*itr));
}
}