Hello Andy, Andy Bartz wrote: > Right now I'm doing it like this: [SNIP] > list<osg::Pnt3f>::iterator listIt; //Iterator for a list which is filled > with the positions of the clicked triangles
you might want to use a list of triangle indices for use with a TriangleIterator, that way you can also copy the correct normals for your triangles - instead of using Vec3f(0.f, 0.f, 1.f), which will result in incorrect lighting for the selected triangles (unless of course the material used for selected triangles is unlit, but then you would not need any normals at all). > osg::GeoPositions3fPtr pos = osg::GeoPositions3f::create(); > osg::GeoColors3fPtr clrs = osg::GeoColors3f::create(); > osg::GeoNormals3fPtr normals = osg::GeoNormals3f::create(); > > for (listIt=hitTrianglePositions.begin(); > listIt!=hitTrianglePositions.end(); ++listIt) > { > osg::beginEditCP(pos, osg::GeoPositions3f::GeoPropDataFieldMask); > pos->addValue(*listIt); > osg::endEditCP(pos, osg::GeoPositions3f::GeoPropDataFieldMask); > > osg::beginEditCP(clrs, osg::GeoColors3f::GeoPropDataFieldMask); > clrs->addValue(osg::Color3f(255,215,0)); > osg::endEditCP(clrs, osg::GeoColors3f::GeoPropDataFieldMask); > > osg::beginEditCP(normals, osg::GeoNormals3f::GeoPropDataFieldMask); > normals->addValue(osg::Vec3f(0,0,1)); > osg::endEditCP(normals, osg::GeoNormals3f::GeoPropDataFieldMask); > } you can nest beginEditCP/endEditCP calls, so it would be better (performance wise) to move those outside the loop. [SNIP] - the rest looks ok to me, so updating the volume should fix it. > btw, is there another way to delete/destroy a node than subRefCP(node)? no, that would pretty much defeat the purpose of reference counting (OpenSG 1.x is admittedly a bit inconsistent in its ref counting, but still). Cheers, Carsten ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://ad.doubleclick.net/clk;226879339;13503038;l? http://clk.atdmt.com/CRS/go/247765532/direct/01/ _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users