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

Reply via email to