Robert, I'm not sure. I'll try making my "own" frame stamp and see what I get.
-B -----Original Message----- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield Sent: Thursday, February 03, 2011 11:30 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Why does Draw skip frame number as reported from FrameStamp::getFrameNumber()? Hi Brad, Could it be simply that the same FrameStamp is used by the Viewer for all frames with the frame number + time being updated rather than it creating a new FrameStamp every frame. Have a tweak of the osgViewer code that updats the FrameStamp on each new frame so it assigns a new FrameStamp if it doesn't already. Robert. On Thu, Feb 3, 2011 at 7:21 PM, Brad Colbert <bcolb...@rscusa.com> wrote: > SingleThreaded and CullDrawThreadPerContext behave as I would expect. > > SingleThread output: > > Pre 0x2b63900 : 1692 > Pos 0x22e5fa0 : 1692 > > Pre 0x2b63900 : 1693 > Pos 0x22e5fa0 : 1693 > > Pre 0x2b63900 : 1694 > Pos 0x22e5fa0 : 1694 > > Pre 0x2b63900 : 1695 > Pos 0x22e5fa0 : 1695 > > > > -B > > -----Original Message----- > From: osg-users-boun...@lists.openscenegraph.org > [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert > Osfield > Sent: Thursday, February 03, 2011 10:57 AM > To: OpenSceneGraph Users > Subject: Re: [osg-users] Why does Draw skip frame number as reported from > FrameStamp::getFrameNumber()? > > Hi Brad, > > What happens when you run SingleThreaded or CullDrawThreadPerContext? > > Robert. > > On Thu, Feb 3, 2011 at 6:27 PM, Brad Colbert <bcolb...@rscusa.com> wrote: >> One more update: >> >> I modified the code slightly in both the Pre and Post draw callbacks to >> compare frame numbers. I would expect that they would have the same number, >> but they do not at times. >> >> I also added a bit of code to the PostDraw to compare the last frame number >> to the current. The results are not what I would expect. >> >> Again, this is DrawThreadPerContext. >> >> Output snipet: >> >> Pre 0x7fffe5f49f90 : 1501 >> Pos 0x7fffe66f6ea0 : 1501 >> >> Pre 0x7fffe5f49f90 : 1502 >> Pos 0x7fffe66f6ea0 : 1503 ** Not Next ** previous frame was 1501 >> >> Pre 0x7fffe5f49f90 : 1503 >> Pos 0x7fffe66f6ea0 : 1503 ** Not Next ** previous frame was 1503 >> >> Pre 0x7fffe5f49f90 : 1504 >> Pos 0x7fffe66f6ea0 : 1504 >> >> Pre 0x7fffe5f49f90 : 1505 >> Pos 0x7fffe66f6ea0 : 1506 ** Not Next ** previous frame was 1504 >> >> -B >> >> >> -----Original Message----- >> From: osg-users-boun...@lists.openscenegraph.org >> [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Brad Colbert >> Sent: Thursday, February 03, 2011 10:11 AM >> To: 'OpenSceneGraph Users' >> Subject: Re: [osg-users] Why does Draw skip frame number as reported from >> FrameStamp::getFrameNumber()? >> >> 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: osg-users-boun...@lists.openscenegraph.org >> [mailto:osg-users-boun...@lists.openscenegraph.org] 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 <bcolb...@rscusa.com> 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 >>> 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 >> _______________________________________________ >> 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 > _______________________________________________ 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