It was a bit hard to describe. Let me try to take one more crack at it. I have an object derived from an osg::Node for which I've implemented my own virtual void traverse(osg::NodeVisitor& nv).
Inside that traverse I keep track of the frame number as reported from the CullVisitor. In a PostDrawCallback on the camera, I compare the frame number as reported by the renderInfo to the frame number(s) that where recorded in my derived nodes cull traversal. I would expect that the PostDrawCallback would be one frame number behind the cull traversal node, but what I see is the PostDrawCallback is skipping frame numbers. The print out below (all the numbers) is a per frame output from the PostDrawCallback. The left most number is the frame number as reported by renderInfo within the PostDrawCallback. It clearly skips and repeats numbers and I'm just trying to understand why, and how I should deal with it. -B -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Robert Osfield Sent: Thursday, February 03, 2011 9:14 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Why does Draw skip frame number as reported from FrameStamp::getFrameNumber()? Hi Brad, I couldn't make sense of your original email and same with this one, I'm confused by the role of your map and would suspect that your method is the cause of the odd output. The way I'd check the current frame number is to simply have a draw callback directly output the frame number. Robert. On Thu, Feb 3, 2011 at 5:07 PM, Brad Colbert <[email protected]> wrote: > I'm resending this with a new Subject: line. Worried that it was a little > too cryptic. > > I'm trying to understand how the threading works in OSG when > DrawThreadPerContext with respect to which process is on which frame at which > time. It appears to me that the draw frame is skipping values in the frame > count, as reported from FrameStamp::getFrameNumber(). > > My test code fills a map<int,bool> (the int is the frame time, and bool is > just there ;) ) in a cull traversal by using the following code: > > // > const osg::FrameStamp* frameStamp = cv->getFrameStamp(); > > frameMap[frameStamp->getFrameNumber()] = true; > > > // > And in a PostDrawCallback on a camera I'm printing out the current frame # : > the frames #'s in the map, and then I clear the current frame number entry: > > // Get the current frame number > osg::FrameStamp* frameStamp = renderInfo.getState()->getFrameStamp(); > > int frameNumber = frameStamp->getFrameNumber(); > > std::cout << frameNumber << " : "; > > std::map<int, bool>::const_iterator framei = frameMap.begin(); > > for (; framei != frameMap.end(); framei++ ) > std::cout << framei->first << ", "; > > std::cout << "\n\n"; > > frameMap.erase( frameNumber ); > > > The following is the output on the console. Again, the first number is the > current frame number in the PostDrawCallback of the camera. The following > numbers, on the same line, are the frame numbers placed in the map during the > cull traversal. > > > 746 : > > 747 : > > 749 : 748, 749, > > 750 : 748, 750, > > 751 : 748, 751, > > 752 : 748, 752, > > 753 : 748, 753, > > 754 : 748, > > 755 : 748, 755, > > 756 : 748, > > 757 : 748, 756, 757, > > 758 : 748, 756, 758, > > 759 : 748, 756, 759, > > 759 : 748, 756, > > 761 : 748, 756, 760, 761, > > > My question is, why is the draw skipping frame numbers? > > --- > Brad Colbert > Renaissance Sciences Corporation > > _______________________________________________ > 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 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

