Hi Sukender,

On Thu, Jan 15, 2009 at 12:06 PM, Sukender <suky0...@free.fr> wrote:
> So, to avoid having two objects updated with 2 different time stamps, is it 
> ok if I:
> - Fill matrix buffers with physics timestamped matrices (PUT - physics thread)
> - Update in a batch all the display matrices from the latest timestamp that 
> is available over all buffers (display thread)
> - Remove data that is before that timestamp on all buffers.

I'd have one time stamp per matrix/value that is pushed in from the
physics thread, and then the rendering thread pulls the appropriate
matrix/maitrces/values according to the time stamp(s) that look most
appropriate.

One could also do a batch copy of from all the buffers to all the
scene graph related values at one time.

As for the data structure required, a custom ring buffer implemented
on top of a std::vector<> would probably work just fine. However, I'm
just waving my hands around, I haven't actually done much work with
physics integration personally, others who've been there and done that
would probably be best placed to give the low level recommondations.

> Does that solution cost much RAM if we have a physics that run very 
> frequently (Ex: 1kHz)? Or may we create a buffer that only stores 2 latest 
> matrices since there is no reason for the physics to not update all objects?

If you running at really high frequences then one would need to take
in account how big these buffers might get, in which case you'd want
to cut down the number of matrices/values you store, perhaps not even
record them every frame, all the rendering thread needs to one
matrix/value per frame.

Robert.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to