Hi Aruna,
What I do to pause the "game loop" is pass an own controlled
simulationTime to the frame call method.
Something like:
double simulationTime;
osg::Timer timer;
osg::Timer::timer_t startTick;
bool pause;
void pause()
{
pause = !pause;
if(pause)
startTick = timer.tick();
else {
timer.setStartTick(timer.getStartTick()+(timer.tick()-startTick));
}
}
void main() {
...
pause = false;
startTick = timer.tick();
simulationTime = timer.time_s();
while(!viewer.done())
{
if(!pause)
{
simulationTime = timer.time_s();
}
viewer.frame(simulationTime);
}
...
}
Not sure if it's completely correct because I have similar code inside
a big class so I tried to extract the "pause" part :). You can use a
viewer GUIEventHandler to implement the pause method catching for
example a key (i.e. 'p').
Hope this helps,
Cheers,
Rafa.
2010/11/19 Aruna Madusanka <[email protected]>:
> Hi,
>
> ...
> How can I pause the game loop in osg? Can any 1 help?
>
> Thank you!
>
> Cheers,
> Aruna
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=33846#33846
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
--
Rafael Gaitán Linares
Instituto de Automática e Informática Industrial http://www.ai2.upv.es
http://gvsig3d.blogspot.com
Ciudad Politécnica de la Innovación
Universidad Politécnica de Valencia
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org