Elliminating Flicker


I’m having trouble getting rid of some annoying flicker. I am using an off-screen contex to render my scene as follows:


…which should get rid of the flicker. But it doesn’t.

Could it be because I need to optimise my ‘drawWorld’ method?


Make sure you’re requesting double-buffer at GL context creation.

Yeah, it’s definitly turned on as I turned it off and experienced real flicker

It seems to happen when I push a key to move the camera… the whole openGL window flashes grey for a milisecond before the image is drawn.

Any ideas anyone?

Perhaps you’re doing more than you should when you press a key. If there’s no flicker while you’re not pressing a key (assuming your animation continues running with no keys being pressed), then that might be it.

Otherwise, it could be that you are no syncing your refresh with the VBL update.

Thanls! I think that may be the cause of the problem…

I’ll invesigate it after some sleep

flash grey… that seem like the erasebkgnd message of the window isnt intecepted and that clears the window with the standard button color ( in windows its often grey)

I figured it out…

After my onKeyPress() event I was calling Invalidate(). This had the effect of greying out the whole window as it invalidated the window content.

I should really have been calling FormPaint(Sender);

Thanks for your help! You were both kindof right in your own ways