Hi David,

First up always use vsync enabled, this improves visual quaulity and automatically gates your app so it doesn't run any faster than what you mointor required, this will also allow the CPU to idle.

Robert.

On 10/13/06, David Johansson <[EMAIL PROTECTED]> wrote:
Hi everyone.

I have a quick question about reducing cpu-load and "fps-controling".
Simply, is it okay to have an main-loop that looks like this; and how
can i "release" the cpu to do other things for a couple milliseconds?
Eventually i intend to use this to save cpu-usage when my program is
running in the background.

[code]
osg::Timer_t beginNewDraw;
double drawTime;
    while( window1->windowIsAlive() )
    {
        if(drawTime>0.014 /* about 70 per second*/){
           beginNewDraw = osg::Timer::instance()->tick();
           window1->update(); /*cull, etc..*/
        }else{
           //release cpu for ( 0.014 - drawTime)
        }
    drawTime = osg::Timer::instance()->delta_s( beginNewDraw,
osg::Timer::instance()->tick() );
    }
    return 0;
}
[/code]

Best regards,
David
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to