PDA

View Full Version : Windows flicker



06-14-2000, 11:30 AM
I have alot of flicker and I want to get rid of it.

I am using MFC and displaying OpenGL graphics in a CView. I use a slider control to manipulate the viewpoint. When the user moves the slider the program calls Invalidate and UpdateWindow which in turn calls OnDraw whichs uses the value from the slider to change the viewpoint. I am not doing anything graphically intensive yet. I have PFD_DOUBLEBUFFER enabled and SwapBuffers(m_pDC->m_hDC)is used in OnDraw.

Is there a way to stop the flicker?

MikeC
06-14-2000, 12:07 PM
The flicker probably comes from Windows erasing the view background with solid white whenever you draw to it. I think you can disable this by providing a no-op OnEraseBackground callback handler, but it's been years since I looked at MFC so my memory's a little hazy.

07-16-2000, 01:39 AM
I had the same problem and solved it by using
InvalidateRect(NULL,FALSE).
The Background will not be updated, so there is no flickering.

Siwko
07-18-2000, 03:20 AM
Use classwizard to include a handler for WM_ERASEBKGND, and within the code handler it provides, comment out the return that calls the base class as such:

BOOL CMyViewClass::OnEraseBkgnd(CDC *pDC)
{
// return CView::OnEraseBkgnd(pDC)
return TRUE;
}

This tells windows that your app is the one thats handling window erases and causes the windows framework not to.

Siwko