Hi,
> You need to think about whether you need to delete Camera's > dynamically during the applications life, you haven't explained why > you are doing this and why not keeping the Camera around is not > appropriate so I can't comment on the validity of what you are doing. > I don't need to remove it during runtime, I remove it on exit. Obviously it's a good idea to remove stuff on exit to avoid memory leaks. You *could* just leave your scene as it is and let OSG clean it up when the viewer exits - but I like to follow the principle of: whoever creates an object should be responsible for removing it ;) > > Also something that seems a bit odd - why an in scene graph Camera has > a GraphicsContext assigned to it. Normally in scene graph Camera > don't have an GraphicsContext, instead inherit the GraphicsContext > from the viewer's Camera. If Camera needs it's own > GraphicsContext/Window then would typically best done by having a > Camera at the Viewer level rather than in the scene graph. Again I > don't know why you've gone for the approach you have, all I can say it > might not be appropriate. I assigned the same GraphicsContext that I'm using for the window. I thought that would be equivalent to just leaving the GraphicsContext as NULL and letting it inherit, I didn't realize there might be side effects to explicitely setting the GraphicsContext. Thanks for this note, now I have a better understanding of what Camera::setGraphicsContext actually does :) So I guess we have at least 3 different workarounds then: - Leave the camera's GraphicsContext as NULL - Remove the Camera's children before removing the Camera - Wait for the graphics thread to finish (i.e. stop viewer threading) before removing the camera ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=68393#68393 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org