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

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Wed Nov 25 11:52:08 PST 2009

Hi all,

So I just wanted to post my latest code that can reproduce this issue, 
and see if I can get Robert's attention so he can check it out. It may 
be related to the crashes others are seeing with texture pools and/or 
VBOs lately, but it might not. It's also triggered by starting/stopping 
viewers, but it's reproducible in OSG 2.6 so it's probably not related 
to the latest texture pool code (unless a bug has carried over from before).

The code attached can be changed using #defines at the top of the 
osgviewer.cpp file to demonstrate the problem and two possible workarounds.

First, you can make the program use either 
osgParticle::PrecipitationEffect or the SiltEffect that's present it 
osgOcean. Both will reproduce the problem and will react the same to the 
workarounds (which makes sense since the SiltEffect is a modified 
PrecepitationEffect to begin with). Change between the two by changing 
the #define USE_EFFECT to either SILT or PRECIPITATION.

Then, if you comment both the defines that follow (that start with 
WORKAROUND_) you should be able to reproduce the bug. Run the program 
with those two defines commented, and when the window comes up, press 
'a'. You'll get a new window. Press 'a' again and the window will close. 
Repeat this. On both Linux and Windows, after 2-3 times, the window 
becomes gray (partially or completely) and I get

Warning: detected OpenGL error 'invalid value' at After Renderer::compile

Additionally, under Windows, after a few more opens/closes, the app 
crashes. On Linux it seems to crash much less often, sometimes it does, 
but most of the time I just get the gray window.

Now, you can test out the two workarounds by uncommenting one of the two 
WORKAROUND_* defines. The first one is to share contexts, and the second 
is to not reuse context IDs (by incrementing the context ID usage count 
so that a new one is used each time). We're currently using the latter 
workaround in our app, and it works well, but of course it would be 
better if OSG could clean up after itself correctly when a context is 
destroyed and then the context ID reuse would work as intended.

So, I hope this example code helps reproduce and squash another bug... 
Let me know if there's more I can do to help. Thanks,

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SiltEffect.zip
Type: application/x-zip-compressed
Size: 11821 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20091125/5d61ba49/attachment.bin>

More information about the osg-users mailing list