On Monday 08 February 2010 09:38:53 pm Paul Martz wrote:
> Ricardo Ruiz wrote:
> > Thanks.
> >
> > Just one question, OSG renders at the maximun amount of FPS it can, but
> > ODE requires a fixed time step. How do you solve this problem? Thanks a
> > lot.
> 
> Is there a reason you're not synced to vertical swap? If you were to
> enable that, then OSG would render at the refresh rate of the monitor
> (unless you have a huge rendering load). Assuming you use the monitor
> refresh rate as the ODE simulation interval, then the two sample rates
> would match. End of problem.
> 
> I'm not sure my Bullet work will help here, as Bullet doesn't require a
> fixed time interval. You just pass an arbitrary elapsed time interval to
> stepSimulation and Bullet produces sim results accordingly.
> 
> osgBullet (at http://osgbullet.googlecode.com) includes a mechanism to
> share transform data between separate rendering and physics threads,
> allowing both to run at whichever rate they choose (not to mention take
> advantage of multicore systems). So if you can't find any way for ODE
> and OSG to use the same sample rate, then a mechanism like this might help.
> 
> I seem to recall someone making some changes to osgViewer a while back
> to control the frame rate. I didn't really follow that change or
> discussion. Maybe just looking at the source code would be revealing.
>     -Paul
> 
> 
> 
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
Hi,

I'm working on a project (work in progress, still growing) which combines 
bullet and osg. Currently there are only rigid bodies and I'm not using 
osgBullet or osgPhysics. 
What I've done so far:
- separate threads for bullet and osg
- usage of btDiscreteDynamicsWorld
- a loader which loads 3d objects and calculates simplified collision bodies

Any loaded 3d object is attached to the OSG-graph and its collision body is 
attached to the DynamicsWorld. 
The physics thread runs at a high frequency while the gfx-thread is synced to 
the vertical swap. Even if vsync is off you can implement a frame limiter by 
measuring the time a single frame needs to be calculated. You can then put the 
gfx thread to sleep (OpenThreads::Thread::microSleep()).
You can calculate the frame-time in the same way for the physics-thread. Use 
this value as simulation step. The high update rate of the physics thread 
prevents punch-through effects for fast moving objects. 
The transform data of the collision bdoy is read from the gfx-thread in an OSG 
update callback. You may have to sync both threads here. 

Greetings
Mathias Buhr
-- 
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to