PDA

View Full Version : Elliminating Flicker



nickcartwright
10-06-2003, 09:47 AM
Hiya,

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




glMatrixMode(GL_MODELVIEW);
glLoadIdentity;
world.drawWorld;
OpenGL1.Swap;
OpenGL1.ErrorCheck('FormPaint');


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

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

Thanks.

10-06-2003, 10:52 AM
Make sure you're requesting double-buffer at GL context creation.

nickcartwright
10-06-2003, 12:14 PM
Yeah, it's definitly turned on as I turned it off and experienced real flicker http://www.opengl.org/discussion_boards/ubb/smile.gif

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?

10-06-2003, 02:34 PM
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.

nickcartwright
10-06-2003, 02:39 PM
Thanls! I think that may be the cause of the problem...

I'll invesigate it after some sleep http://www.opengl.org/discussion_boards/ubb/smile.gif

Mazy
10-07-2003, 01:11 AM
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)

nickcartwright
10-07-2003, 05:36 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif