Hi Chris, one of the problem could be delays from sensors. to make things better I would suggest to have a three (maybe two will be enough, but generally an algo is such that it switches lists when either 'sensor' frame is finished and osg frame is finished - thus sensor frame and osg frame are completely separate and this requires three similar lists for sensor data ) lists which will store data from sensor - so that sensor thread pushes data to list and osg reads another list - and you switch pointers to lists everytime you make a frame() step - this way you don't wait for sensor data and process it as fast as osg can, but you always have a fresh data.
Regards Sergey On Tue, Oct 21, 2014 at 6:41 PM, Robert Osfield <robert.osfi...@gmail.com> wrote: > Hi Chris, > > How to optimize your application will depend on where the bottleneck is. > I'd suspect CPU, but as I don't have your application and data in front of > me I can't really provide any specific advice. > > One thing I would suggest is making sure you are testing performance with > a release build. Debug builds, especially under Windows are very slow > indeed and will suggest bottlenecks that simply don't exist in final > applications. > > Robert. > > > On 21 October 2014 15:20, Chris Hidden <ch...@erghis.com> wrote: > >> Hey everyone. >> >> I've come a far way since my last post. Our application is reading >> sensor data from the Leap Motion and we are interpreting this data and >> using OSG to display the hand models on scene. The issue now is that >> running on my laptop I get a tops of 20 fps. On other computers with lower >> specs the fr is abysmal. >> >> The way its set up right now is that we load the fbx model of a hand and >> traverse through its nodes. If it finds a bone and if it is one of the >> bones we want to affect we attach an updateCallback. The update callback >> queries our data for a new position and the position is updated using a >> matrix and then the new position is set: >> >> >> Code: >> >> osg::ref_ptr<osgAnimation::Bone> bone = >> dynamic_cast<osgAnimation::Bone*>(node); >> >> if (bone) >> { >> ref_ptr<osgAnimation::Bone> parent >> = bone->getBoneParent(); >> const osg::Matrix& matrix >> = _transforms.getMatrix(); >> _transforms.update >> (); >> setBoneOrientations >> (); >> setLocalMatrices >> (); >> setLocalTranslationsAndRotations (parent, &matrix); >> >> >> >> >> >> if (parent) >> bone->setMatrixInSkeletonSpace(fingerSpace * >> fingerTranslation * parent->getMatrixInSkeletonSpace()); >> } >> >> traverse(node, nv); >> >> >> >> >> The setBoneOrientations(), setLocalMatrices() and >> setLocalTranslationsAndRotation() are methods used to manipulate the data >> so the it fits the position and rototaion on the screen properly. Basically >> converting the data to osg coordinate spaces. >> >> The viewer is basically just while(!viewer->done()) >> >> I believe in total we end up attaching a callback to about 40 - 50 >> bones. 20-25 on each hand. This doesn't feel like too much to process but >> Im no expert... far from it. Is this the reason causing my low frame >> rate? If so what are some steps or things to start looking at to improve >> performance. >> >> Thanks everyone! >> >> ------------------ >> Read this topic online here: >> http://forum.openscenegraph.org/viewtopic.php?p=61349#61349 >> >> >> >> >> >> _______________________________________________ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org