使用opengl在windows窗体中绘图时闪烁的问题

OPENGL MFC 闪烁

The flicker occurs because Windows paints the background first and then OpenGL next. Since we have OpenGL doing the job of clearing the background, we'll turn off Windows from clearing the background. This can be done by editing OnEraseBkgnd() member function appropriately. We do this by returning true from the function.

BOOL COpenGLView::OnEraseBkgnd(CDC* pDC) 
{
    // TODO: Add your message handler code here and/or call default
    //comment out the original call
    //return CView::OnEraseBkgnd(pDC);
    //Tell Windows not to erase the background
    return TRUE;
}

你可能感兴趣的:(技术心得)