PDA

View Full Version : Is there any way to prevent the screen from flashing when swapbuffering



jiangerlai
11-15-2005, 06:06 PM
I am using double buffers. Each time when I call swapbuffers after I render, the screen flashes, which makes my eyes uncomfortable. Is there any solution to this problem.

jiangerlai
11-16-2005, 12:11 AM
I am using Visual C++6.0

mikael_aronsson
11-16-2005, 12:16 AM
Are you sure that you have setup doublebuffering correct ? because if you do there should be no flashing at all.

Overmind
11-16-2005, 12:46 AM
Have you tried turning vsync on?

jiangerlai
11-16-2005, 04:14 AM
I think I need to write my problem in detail. I call OpenGL functions including swapbuffers in OnDraw function of a window. And I popup a messagebox for the user to select something frequently. When the focus return to the window, the window's OnDraw function is run automatially, and its screen flashes. That is the problem.
Who knows how to do?

jiangerlai
11-16-2005, 04:30 AM
Originally posted by Overmind:
Have you tried turning vsync on?I turned it on. But it did not work.

Relic
11-16-2005, 04:43 AM
Could be that the window is cleared with GDI during the WM_ERASEBKGND message.
Implement a handler for OnEraseBkgnd() which just returns non-zero.
That means it does no rendering and also does not route the message to the default window message handler which normally erases the background for you.
This should prevent GDI from clearing the window and only your OpenGL redraw should update it flicker free.

jiangerlai
11-16-2005, 02:54 PM
Relic, Thank you. It is done.