From Almalric Alexandre, "I've noticed that all osgViewerMFC example from osg 2.x.x are flickering when resizing 3D view, to avoid this only add OnEraseBkgnd callback in CMFC_OSG_MDIView class and do nothing in it. Just like the WxWidget example.

Attached the modified version of MFC_OSG_MDIView.cpp and MFC_OSG_MDIView.h."

Note from Robert Osfield, submission came with wrong header file, so have had
to guess at what it should be, fingers crossed it worn't break windows build... :-)
This commit is contained in:
Robert Osfield 2007-09-03 10:04:34 +00:00
parent 027158b441
commit 07e94c8ce0
2 changed files with 8 additions and 0 deletions

View File

@ -17,6 +17,7 @@ BEGIN_MESSAGE_MAP(CMFC_OSG_MDIView, CView)
ON_WM_CREATE() ON_WM_CREATE()
ON_WM_DESTROY() ON_WM_DESTROY()
ON_WM_KEYDOWN() ON_WM_KEYDOWN()
ON_WM_ERASEBKGND()
END_MESSAGE_MAP() END_MESSAGE_MAP()
CMFC_OSG_MDIView::CMFC_OSG_MDIView() : CMFC_OSG_MDIView::CMFC_OSG_MDIView() :
@ -107,3 +108,9 @@ void CMFC_OSG_MDIView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
} }
} }
BOOL CMFC_OSG_MDIView::OnEraseBkgnd(CDC* pDC)
{
/* Do nothing, to avoid flashing on MSW */
return true;
}

View File

@ -43,6 +43,7 @@ protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy(); afx_msg void OnDestroy();
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
}; };
#ifndef _DEBUG // debug version in MFC_OSG_MDIView.cpp #ifndef _DEBUG // debug version in MFC_OSG_MDIView.cpp