PDA

View Full Version : Glut does not refresh screen on WinXP!!



holyburak
03-24-2004, 10:23 PM
Hi all,

I've coded some simple skeletal animation. It uses multimedia timer. It works at office PIV Win 98 but at home at my old PIII , Win XP machine i have to move the mouse on the glut screen while the animation goes on. Is this because glut does not suppport Win XP?
I can post the whole code to anyone interested.
Code is sth like ;

void CALLBACK CAnSequence::TimerFunction(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
CAnSequence *seq = (CAnSequence*) dwUser;
seq->m_current_frame++;
if(seq->m_current_frame >= seq->m_frames)
{
seq->m_timer->Stop();
}
seq->Update();
glutPostRedisplay();

}

void animation(void)
{
seq.Play();

glutIdleFunc(NULL);
}

void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

seq.m_figure->DisplayDeformed(SOLID);

glutSwapBuffers();

}

void keyboard(unsigned char key, int x, int y)
{
if (key == 27) exit(0);

if( key == 'r') {
if(xrot == 0) xrot = 4;
glutPostRedisplay();
}
if( key == 'a') {
glutIdleFunc(animation);
}

}

03-24-2004, 11:59 PM
looks like your program will only show yourdisplay func if you press 'a'. was that intentional?

-=[ regards ]=-

holyburak
03-25-2004, 02:24 AM
Yes it was ..

Honk
03-25-2004, 03:48 AM
From the documentation:


glutIdleFunc sets the global idle callback to be func so a GLUT program can perform background processing tasks or continuous animation when window system events are not being received. If enabled, the idle callback is continuously called when events are not being received. The callback routine has no parameters.The current window and current menu will not be changed before the idle callback. Programs with multiple windows and/or menus should explicitly set the current window and/or current menu and not rely on its current setting.

The amount of computation and rendering done in an idle callback should be minimized to avoid affecting the program's interactive response. In general, not more than a single frame of rendering should be done in an idle callback.

Passing NULL to glutIdleFunc disables the generation of the idle callback.
That could be the problem. I wouldn't use the idle function anyway, I prefer the timer whenever I use glut.