From 65c8357f76d857b49ff9a0b626304498644a13fa Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 14 Jul 2009 12:22:47 +0000 Subject: [PATCH] From Alexandre Amalric, "I'm using osg svn version 2.9.5 and I've apparently found a bug in osgPlugin logo. When using more than one view logosCullCallback function is called without checking context ID from the cull visitor is equal to logo _contextID variable. It involves updating logo's viewport with different sizes. So I made a fix well working, at least the way I use the plugin." Note, from Robert Osfield, changed code to return true to signal culling of logo when being applied to a window that it wasn't assigned to. --- src/osgPlugins/logo/ReaderWriterLOGO.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/osgPlugins/logo/ReaderWriterLOGO.cpp b/src/osgPlugins/logo/ReaderWriterLOGO.cpp index a8707a787..48ed407af 100644 --- a/src/osgPlugins/logo/ReaderWriterLOGO.cpp +++ b/src/osgPlugins/logo/ReaderWriterLOGO.cpp @@ -39,6 +39,15 @@ class Logos: public osg::Drawable { Logos *logos = dynamic_cast (drawable); osgUtil::CullVisitor *cv = dynamic_cast(visitor); + if (!cv) return true; + + unsigned int contextID = cv->getState()!=0 ? cv->getState()->getContextID() : 0; + if(contextID != logos->getContextID()) + { + // logo not appropiate for window assigned to the cull visitor so cull it. + return true; + } + if( logos != NULL && cv != NULL ) { osg::Viewport *vp = cv->getViewport(); @@ -168,7 +177,9 @@ class Logos: public osg::Drawable } osg::Viewport *getViewport() { return _viewport.get(); } + void setContextID( unsigned int id ) { _contextID = id; } + unsigned int getContextID() { return _contextID; } bool hasLogos() {