Solution of flash screen caused by OpenGL in MFC environment

Since OpenGL has its own background refresh function, glClear, Windows should not be allowed to refresh a window background. Otherwise, when the window needs to be redrawn, Windows automatically sends WM_ERASEBKGND first, and the default handler uses a white background brush. When the background color used by OpenGL is not white, there is a flicker of white in the drawing. This is especially true when doing animation.

Activate the WM_ERASEBKGND message handler in the MFC program to disable message processing of the parent window class, and simply return a TRUE. Return CView::OnEraseBkgnd(PDC). Now change this to return TRUE. This will solve the flash screen problem.

Read More: