Wednesday, 2 October 2013

glutTimerFunc() callback function isn't executed if time threshold is under a certain number of msecs

glutTimerFunc() callback function isn't executed if time threshold is
under a certain number of msecs

I am working with an application which requires an engine to be executed
in the lowest amount of time as possible by a GLUT GUI using the
glutTimerFunc():
void SetGLUTTimer(void);
void callback(int value)
{
Engine* pEngine;
pEngine = (Engine*) value;
pEngine->Process();
pEngine->SetGLUTTimer();
}
void Engine::SetGLUTTimer(void)
{
glutTimerFunc(50, callback, (int)this);
}
bool Engine::Run(void)
{
if (m_pViewer != NULL)
m_pViewer->Run();
else
return false;
return true;
}
If I set the time threshold to 1000 msecs or more the engine callback will
be regularly called, while any other interval below a second (like in the
example above) will cause the GUI to run indefinitely never executing the
engine Process() function.

No comments:

Post a Comment