glutGameMode Flicker Problem

I am running in gameMode and using the glut timer func with 1 sec updates.

Inside the glutTimer callback, I call glutPostRedisplay.

Unfortunately, the objects aren’t being refreshed enough; they disappear.

I added glutIdleFunc, but that makes the objects constantly flicker.

If I don’t run in gameMode everything works.

Any idea what’s going on?

Thanks for the help.

Are you still calling the glutPostRedisplay in the glutTimer function?

The flicker could be you are moving data faster then your video card can handle. Make sure you only update it in one routine and not both.

Also it could be how you are drawing your objects, they should not disapear because your update is too slow.

Originally posted by AngryChipmunk:
[b]I am running in gameMode and using the glut timer func with 1 sec updates.

Inside the glutTimer callback, I call glutPostRedisplay.

Unfortunately, the objects aren’t being refreshed enough; they disappear.

I added glutIdleFunc, but that makes the objects constantly flicker.

If I don’t run in gameMode everything works.

Any idea what’s going on?

Thanks for the help.[/b]

If you are using double buffering, do you swap buffers only when in this timer function?

It sounds to me like you are NOT double buffering and you need to. Look into double buffering and request double buffering from GLUT. You need to redraw EVERYTHING every frame to make this work, but that’s how almost all 3D animated applications & games work.