当前位置: 首页>>代码示例>>C++>>正文


C++ Contexts::end方法代码示例

本文整理汇总了C++中Contexts::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Contexts::end方法的具体用法?C++ Contexts::end怎么用?C++ Contexts::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contexts的用法示例。


在下文中一共展示了Contexts::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: wglMakeCurrent

WINGDIAPI BOOL WINAPI wglMakeCurrent(HDC hdc, DHGLRC hglrc)
{
    if (!gCurrentContextSet)
    {
        gCurrentContext = gContexts.end();
        gCurrentContextSet = true;
    }

    if (!hdc || !hglrc)
    {
        gCurrentContext = gContexts.end();
        return 1;
    }

    int rc = (int)hglrc;

    if (gContexts.find(rc) == gCurrentContext)
    {
        return 1;
    }

    gCurrentContext = gContexts.find(rc);

    auto &xCtxt = gContexts[rc];
    OGL::State *pState = xCtxt.pState;

    HWND hWnd = WindowFromDC(hdc);
    RECT rect;
    GetClientRect(hWnd, &rect);

    int width = rect.right - rect.left;
    int height = rect.bottom - rect.top;

    SetOGL(pState);
    OGL::GetDDProcTable().pfnBindContext(OGL::GetDDHandle(), NULL, hWnd, NULL, width, height);

    // according to spec, only set current viewport to draw buffer dimensions if the context hasn't
    // been initialized
    if (!xCtxt.initialized)
    {
        pState->mViewport.x = 0;
        pState->mViewport.y = 0;
        pState->mViewport.width = width;
        pState->mViewport.height = height;
        pState->mScissor.x = 0;
        pState->mScissor.y = 0;
        pState->mScissor.width = width;
        pState->mScissor.height = height;
        xCtxt.initialized = true;
    }
    return 1;
}
开发者ID:prabindh,项目名称:openswr,代码行数:52,代码来源:wgl.cpp

示例2: getAllThreads

Viewer::~Viewer()
{
    //OSG_NOTICE<<"Viewer::~Viewer()"<<std::endl;

    Threads threads;
    getAllThreads(threads);

    OSG_INFO<<"Viewer::~Viewer():: start destructor getThreads = "<<threads.size()<<std::endl;

    stopThreading();

    if (_scene.valid() && _scene->getDatabasePager())
    {
        _scene->getDatabasePager()->cancel();
        _scene->setDatabasePager(0);
    }

    Contexts contexts;
    getContexts(contexts);

    // clear out all the previously assigned operations
    for(Contexts::iterator citr = contexts.begin();
        citr != contexts.end();
        ++citr)
    {
        (*citr)->close();
    }

    //OSG_NOTICE<<"finish Viewer::~Viewer()"<<std::endl;

    getAllThreads(threads);

    OSG_INFO<<"Viewer::~Viewer() end destructor getThreads = "<<threads.size()<<std::endl;
}
开发者ID:tachen,项目名称:osg,代码行数:34,代码来源:Viewer.cpp

示例3: setStartTick

void CompositeViewer::setStartTick(osg::Timer_t tick)
{
    _startTick = tick;

    for(RefViews::iterator vitr = _views.begin();
            vitr != _views.end();
            ++vitr)
    {
        (*vitr)->setStartTick(tick);
    }

    Contexts contexts;
    getContexts(contexts,false);

    for(Contexts::iterator citr = contexts.begin();
            citr != contexts.end();
            ++citr)
    {
        osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(*citr);
        if (gw)
        {
            gw->getEventQueue()->setStartTick(_startTick);
        }
    }
}
开发者ID:psigen,项目名称:openscenegraph-release,代码行数:25,代码来源:CompositeViewer.cpp

示例4: stopThreading

CompositeViewer::~CompositeViewer()
{
    OSG_INFO<<"CompositeViewer::~CompositeViewer()"<<std::endl;

    stopThreading();

    Scenes scenes;
    getScenes(scenes);

    for(Scenes::iterator sitr = scenes.begin();
            sitr != scenes.end();
            ++sitr)
    {
        Scene* scene = *sitr;
        if (scene->getDatabasePager())
        {
            scene->getDatabasePager()->cancel();
            scene->setDatabasePager(0);
        }
    }

    Contexts contexts;
    getContexts(contexts);

    // clear out all the previously assigned operations
    for(Contexts::iterator citr = contexts.begin();
            citr != contexts.end();
            ++citr)
    {
        (*citr)->close();
    }

    OSG_INFO<<"finished CompositeViewer::~CompositeViewer()"<<std::endl;
}
开发者ID:psigen,项目名称:openscenegraph-release,代码行数:34,代码来源:CompositeViewer.cpp

示例5: getOperationThreads

void CompositeViewer::getOperationThreads(OperationThreads& threads, bool onlyActive)
{
    threads.clear();

    Contexts contexts;
    getContexts(contexts);
    for(Contexts::iterator gcitr = contexts.begin();
            gcitr != contexts.end();
            ++gcitr)
    {
        osg::GraphicsContext* gc = *gcitr;
        if (gc->getGraphicsThread() &&
                (!onlyActive || gc->getGraphicsThread()->isRunning()) )
        {
            threads.push_back(gc->getGraphicsThread());
        }
    }

    Cameras cameras;
    getCameras(cameras);
    for(Cameras::iterator citr = cameras.begin();
            citr != cameras.end();
            ++citr)
    {
        osg::Camera* camera = *citr;
        if (camera->getCameraThread() &&
                (!onlyActive || camera->getCameraThread()->isRunning()) )
        {
            threads.push_back(camera->getCameraThread());
        }
    }

}
开发者ID:psigen,项目名称:openscenegraph-release,代码行数:33,代码来源:CompositeViewer.cpp

示例6: wglGetCurrentContext

WINGDIAPI HGLRC WINAPI wglGetCurrentContext(VOID)
{
    if (!gCurrentContextSet)
    {
        gCurrentContext = gContexts.end();
        gCurrentContextSet = true;
    }

    if (gCurrentContext == gContexts.end())
    {
        return NULL;
    }
    else
    {
        return reinterpret_cast<HGLRC>(gCurrentContext->first);
    }
}
开发者ID:prabindh,项目名称:openswr,代码行数:17,代码来源:wgl.cpp

示例7: wglGetCurrentDC

WINGDIAPI HDC WINAPI wglGetCurrentDC(VOID)
{
    if (!gCurrentContextSet)
    {
        gCurrentContext = gContexts.end();
        gCurrentContextSet = true;
    }

    if (gCurrentContext == gContexts.end())
    {
        return NULL;
    }
    else
    {
        return gCurrentContext->second.hdc;
    }
}
开发者ID:prabindh,项目名称:openswr,代码行数:17,代码来源:wgl.cpp

示例8:

Display *glXGetCurrentDisplay()
{
    if (currentContext == contexts.end())
    {
        return NULL;
    }
    auto &xCtxt = currentContext->second;
    return xCtxt.pDisplay;
}
开发者ID:NoSuchProcess,项目名称:openswr,代码行数:9,代码来源:glx.cpp

示例9: 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();
}
开发者ID:psigen,项目名称:openscenegraph-release,代码行数:56,代码来源:CompositeViewer.cpp

示例10: execute

void ExecutableOpHolder::execute( const Contexts &contexts ) const
{
	for ( Contexts::const_iterator cit = contexts.begin(); cit != contexts.end(); cit++ )
	{
		// \todo Implement a way to get the CompoundObject for a given context without modifying the Op's parameter
		// and passing it explicitly in the operate call. Than multi-thread this loop.
		Context::Scope scope( *cit );
		constPointerCast<CompoundParameterHandler>( parameterHandler() )->setParameterValue();
		constPointerCast<Op>( getOp() )->operate();
	}
}
开发者ID:7on7on,项目名称:gaffer,代码行数:11,代码来源:ExecutableOpHolder.cpp

示例11: getWindows

void ViewerBase::getWindows(Windows& windows, bool onlyValid)
{
    windows.clear();

    Contexts contexts;
    getContexts(contexts, onlyValid);

    for(Contexts::iterator itr = contexts.begin();
        itr != contexts.end();
        ++itr)
    {
        osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(*itr);
        if (gw) windows.push_back(gw);
    }
}
开发者ID:3dcl,项目名称:osg,代码行数:15,代码来源:ViewerBase.cpp

示例12: glXDestroyContext

void glXDestroyContext(Display *pDisplay, GLXContext ctx)
{
    auto *pState = reinterpret_cast<OGL::State *>(ctx);

    if (contexts.find(pState) == currentContext)
    {
        currentContext = contexts.end();
    }

    contexts.erase(pState);

    OGL::Destroy(*pState);
    pState->~State();

    _aligned_free(pState);
}
开发者ID:NoSuchProcess,项目名称:openswr,代码行数:16,代码来源:glx.cpp

示例13: execute

void ExecutableRender::execute( const Contexts &contexts ) const
{
	const ScenePlug *scene = inPlug()->getInput<ScenePlug>();
	if( !scene )
	{
		throw IECore::Exception( "No input scene" );
	}

	/// \todo This doesn't belong here. It'll be the responsibility of the Despatchers
	/// to save the script if necessary, and to save it to an alternate location than
	/// the current one.
	scriptNode()->save();

	for( Contexts::const_iterator it = contexts.begin(), eIt = contexts.end(); it != eIt; it++ )
	{
		Context::Scope scopedContext( it->get() );
		ConstCompoundObjectPtr globals = scene->globalsPlug()->getValue();

		createDisplayDirectories( globals );

		IECore::RendererPtr renderer = createRenderer();		
		outputOptions( globals, renderer );
		outputCamera( scene, globals, renderer );
		{
			WorldBlock world( renderer );

			outputLights( scene, globals, renderer ); 
			outputWorldProcedural( scene, renderer );
		}
		
		std::string systemCommand = command();
		if( systemCommand.size() )
		{
			const ApplicationRoot *applicationRoot = scene->ancestor<ApplicationRoot>();
			if( applicationRoot && applicationRoot->getName() == "gui" )
			{
				/// \todo We need this weird background execution behaviour because we
				/// don't want to block the ui while rendering, but really the LocalDespatcher
				/// should be responsible for launching a separate process to do the execution
				/// from anyway.
				systemCommand += "&";
			}
			
			system( systemCommand.c_str() );
		}
	}
}
开发者ID:7on7on,项目名称:gaffer,代码行数:47,代码来源:ExecutableRender.cpp

示例14: isRealized

bool CompositeViewer::isRealized() const
{
    Contexts contexts;
    const_cast<CompositeViewer*>(this)->getContexts(contexts);

    unsigned int numRealizedWindows = 0;

    // clear out all the previously assigned operations
    for(Contexts::iterator citr = contexts.begin();
            citr != contexts.end();
            ++citr)
    {
        if ((*citr)->isRealized()) ++numRealizedWindows;
    }

    return numRealizedWindows > 0;
}
开发者ID:psigen,项目名称:openscenegraph-release,代码行数:17,代码来源:CompositeViewer.cpp

示例15: getAllThreads

Viewer::~Viewer()
{
    //OSG_NOTICE<<"Viewer::~Viewer()"<<std::endl;

    Threads threads;
    getAllThreads(threads);

    OSG_INFO<<"Viewer::~Viewer():: start destructor getThreads = "<<threads.size()<<std::endl;

    stopThreading();

    if (_scene.valid() && _scene->getDatabasePager())
    {
        _scene->getDatabasePager()->cancel();
        _scene->setDatabasePager(0);
    }

    Contexts contexts;
    getContexts(contexts);

    // clear out all the previously assigned operations
    for(Contexts::iterator citr = contexts.begin();
        citr != contexts.end();
        ++citr)
    {
        osg::GraphicsContext* gc = *citr;

        // Run destroy operation on each context before closing it
        if (_cleanUpOperation.valid() && gc->valid())
        {
            gc->makeCurrent();

            (*_cleanUpOperation)(gc);

            gc->releaseContext();
        }

        gc->close();
    }

    //OSG_NOTICE<<"finish Viewer::~Viewer()"<<std::endl;

    getAllThreads(threads);

    OSG_INFO<<"Viewer::~Viewer() end destructor getThreads = "<<threads.size()<<std::endl;
}
开发者ID:bjornblissing,项目名称:osg,代码行数:46,代码来源:Viewer.cpp


注:本文中的Contexts::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。