Hi Dan, Are you running the viewer multi-threaded? By default the OSG will check your available CPU cores and enable multi-threading if you have 2 more more cores so it may well be multi-threaded.
When the viewer is running the draw thread in a separate graphics thread the previous frame rendering can run at the same time as the current frames update, event and cull traversals. If you modify a drawable or state component in the update phase while the rendering is still happening then you are likely to get a crash. The OSG has a built in mechanism for preventing to modification and rendering happening at the same time - you simply set the DataVariance on the drawable that you wish to update to DYNAMIC rather than leave it in it's default of STATIC. The other alternative is to set the viewer to SingleThreaded. For more info on this topic have a look through the archives. Robert. On 14 November 2011 03:38, dan marshal <[email protected]> wrote: > I am trying to update a osgText label object. After about 3000 updates I get > a std::bad_alloc termination. > > I am converting a integer value that usually has only 6 or 7 characters in > the string and I thought sprintf would be the fastest and easiest way to > convert from int to std:string. > > What is the fastest way to convert from int to str:string? > > Any suggestions on how to avoid the segmentation termination? > > Thank you for your help. > > cc > > > void quanthud::setLabel(int id, int val) > { > quantLabel->setText(itostr(val)); > } > std::string quanthud::itostr(int val) > { > char buff[14]; > return std::string(buff, sprintf(buff, "%d", val)); > } > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=43855#43855 > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

