[osg-users] Crash in nVidia driver : particles + dynamically adding/removing views

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Wed Nov 4 06:02:43 PST 2009


Hi J.P.,

> with
> #define USE_EFFECT SILT
> I get the gray screen in added view on 3rd 'a'.

Thanks for testing, that's what I saw too on Ubuntu. I expect if you use 
USE_EFFECT PRECIPITATION you'll see the same results.

> Hmm, what is strange is that the modified (extremely hacky) version 
> attached does not crash and seems to work. It just uses a shared 
> context, so maybe there is something in the context vs vertex array that 
> is not working properly.

Yes, well one of my hunches was that something in the context 
creation/reuse was buggy, since the problem appears because we're 
creating, then deleting, then creating contexts. I've traced into the 
code of the effect, and the same context ID seems to be reused the 
second time the secondary view is created (3rd 'a') as the first time 
(1st 'a'). That means that when getting the osg::Drawable::Extensions 
object, the same one that was created for the old context is reused for 
the new context.

But that apparently isn't the problem, because if I force the Extensions 
object to be destroyed when the secondary view is closed (so that the 
next time it's spawned, a new Extensions object will be created) like so:


// In doRemoveView(), between the stopThreading() and startThreading()
unsigned int contextID =
   _view->getCamera()->getGraphicsContext()->getState()->getContextID();
_viewer->removeView(_view.get());
_view = 0;
osg::Drawable::setExtensions(contextID, 0);


it doesn't remove the crash.

Also, I tried to make the scene delete all its OpenGL objects for all 
contexts, like so:


   // Again in doRemoveView() before the startThreading()
   _root->releaseGLObjects();


and it doesn't fix it either.

So yes, it's probably related to the creation/deletion/reuse of contexts 
or context-specific objects, but I haven't been able to pinpoint it yet 
to something that's wrong in OSG itself.

If anyone else would like to take up the challenge of explaining this 
mystery, please step up :-)

Thanks,

J-S
-- 
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com
                                http://www.cm-labs.com/
                         http://whitestar02.webhop.org/


More information about the osg-users mailing list