Hi all,
I have an application where I request from the update thread some
operations that must be performed in a draw callback. The operations
must be performed in the draw of the same thread they were requested
from.
I tried to check the frame from the draw callback, using
renderInfo.getState()->getFrameStamp()->getFrameNumber(). The problem
I found is that this frame number is the one of the frame currently
being processed in the UPDATE frame., as it is a reference to the
FrameStamp structure of the viewer.
The solution I have applied is a change in the file
src/osgUtil/SceneView.cpp, method SceneView::cull, in the line 753,
replacing
state->setFrameStamp(_frameStamp.get());
with
state->setFrameStamp( new osg::FrameStamp(*_frameStamp) );
This way, instead of storing a pointer to the "global" FrameStamp in
the renderInfo structure, I build a copy of the FrameStamp object, so
the draw stage keep this information intact and is not overwritten by
the next frame in the update thread.
I don't know if there is a better solution to this problem. Anyway,
I think that in the renderInfo argument of a draw callback it would be
nice to have the FrameStamp of the frame to which this callback
belongs.
Thoughts? Anybody else has faced problems with frame numbering in
draw callbacks?
Regards,
--
Javier Taibo
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org