Hi Alexis, There are a number of issues at play here.
First up the OSGPL license doesn't just allow you to grab OSG source code and embed it in your application - unless you are planning to publish your application OSGPL, otherwise it's copyright infringement. Secondly if your compiler is complaining of missing functions there is something amiss on the OSG side or something on your side, please report what errors you have. This error needs to be fixed properly not by being hacked around by including OSG code in your application. Finally the runtime error, well it could one of many things but you don't really provide any usual information what this might be. The original code looks fine, so I'd suspect memory corruption of the _normals pointer or an error in the container it points to. Robert. On 14 April 2014 22:42, alexis pierre <[email protected]> wrote: > Hi, > > I think I found a bug in osg 3.2.0 > I needed to use osgUtil::SmoothingVisitor. For some reason my compiler > couldn't find some of the functions so I just added SmoothingVisitor.cpp to > my project (I may have taken that file from 3.2.1 rc2), and I got a big bug: > > in the function normalize I got an ERR_BAD_ACCESS > > Code: > void normalize() > { > if (!_normals) return; > > for(osg::Vec3Array::iterator itr = _normals->begin(); > itr != _normals->end(); > ++itr) > { > (*itr).normalize(); > } > } > > > > So I modified the function as follows: > > > Code: > void normalize() > { > if (!_normals) return; > unsigned long a,b; > a=0; > b=_normals->size(); > > for(osg::Vec3Array::iterator itr = _normals->begin(); > itr != _normals->end()&&a<=(b+1); > ++itr) > { > if (a>=b){ > std::cout<<std::hex<<long(itr.base())<<" > "<<long(_normals->end().base())<<std::endl; > } > a++; > (*itr).normalize(); > } > } > > > > And I got > > Code: > 101f1ce18 101f1ce1c > 101f1ce24 101f1ce1c > > > > So This means that the condition itr != _normals->end() is never false! > > Is it something I am missing? > > Thank you! > > Cheers, > alexis > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=58934#58934 > > > > > > _______________________________________________ > 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

