Simplifying my example, my PostDrawCallback now simply prints the pointer value of *this (to determine that it's the same PostDrawCallback instance) and the frame number and I get the following (snipet):
0x2a9a400:896 0x2a9a400:896 0x2a9a400:898 0x2a9a400:899 0x2a9a400:899 0x2a9a400:901 0x2a9a400:902 0x2a9a400:902 0x2a9a400:904 Clearly it's the same callback, there is only one camera, and the frame number is repeating and skipping. -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

