Flickering scene

Hi guys, a bit of help with this problem please. I render with opengl and no problem in my computer (windows98 amd1300 KyroII) but in other computers almost as powerful as mine, the scene is flickering (I am in window mode). I am using MFC and Visual C++6. I use swapbuffers. It looks like making too much repainting. The speed of the moving objects is fine (no slow down in other computers). I wondered if it is due to different O.S.

Thanks

I don’t think different OS is the problem.
Are you sure you’re using double buffering?

Do you have vertical sync enabled?

Are you using InvalidateRect(NULL, FALSE)? The FALSE prevents a clearscreen in windows which can lead to flicker.

JML, how do you enable vertical sync?

I think JML is talking about VSYNC in the driver options.

There is a proper way to handle this in an app, but some people rely on these damn driver settings. (I’m not talking about you JML)

As a result, from a perfectly valid code, you can get different results on different machines. And you’ve got to tell the end user “be carefull not to have this and this set in the 78th tab of the driver options otherwise it won’t work/look good …”

Just out of curiosity, I know when people used to program VGA 320x200 games there was a port programmers used to poll to determine when vertical sync took place. They’d wait till it was between refreshes to draw the image and thus avoid screen flicker. Is that sort of technique obsolete now is there some way to acheive this in OpenGL?

Originally posted by Furrage:
Just out of curiosity, I know when people used to program VGA 320x200 games there was a port programmers used to poll to determine when vertical sync took place. They’d wait till it was between refreshes to draw the image and thus avoid screen flicker. Is that sort of technique obsolete now is there some way to acheive this in OpenGL?

In theory, it’s called wglSwapIntervalEXT().
In practice, it doesn’t do anything (at least not for me).

However, single buffering IS obsolete. Don’t go there.

Thanks for your help. A very stupid problem. I was not including the PFD_DOUBLEBUFFER flag in the PIXELFORMATDESCRIPTOR. But what really puzzles me is the fact that it was working fine in my AMD, no flickering, and I check to see if it was including the flag without asking for it but not, the flag was not set, and there was no flickering. Only in other computers. Well, anyway, the problem is solved…

How can I enable the vertical sync?

Regards

How to enable/disable vsync depends on your display driver. Usually there is an option in the OpenGL section of the properties. The options are: ‘on’, ‘off’, ‘default on’, ‘default off’.
The latter two allow programs to use a different setting programmatically (via the extension zeckensack mentioned: wglSwapIntervalEXT() ).

HTH

Jean-Marc.