From 07e94c8ce0a0841510093a3e5f085668a6875767 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 3 Sep 2007 10:04:34 +0000 Subject: [PATCH] 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... :-) --- examples/osgviewerMFC/MFC_OSG_MDIView.cpp | 7 +++++++ examples/osgviewerMFC/MFC_OSG_MDIView.h | 1 + 2 files changed, 8 insertions(+) diff --git a/examples/osgviewerMFC/MFC_OSG_MDIView.cpp b/examples/osgviewerMFC/MFC_OSG_MDIView.cpp index a20a5a8e1..64be29736 100644 --- a/examples/osgviewerMFC/MFC_OSG_MDIView.cpp +++ b/examples/osgviewerMFC/MFC_OSG_MDIView.cpp @@ -17,6 +17,7 @@ BEGIN_MESSAGE_MAP(CMFC_OSG_MDIView, CView) ON_WM_CREATE() ON_WM_DESTROY() ON_WM_KEYDOWN() + ON_WM_ERASEBKGND() END_MESSAGE_MAP() 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; +} diff --git a/examples/osgviewerMFC/MFC_OSG_MDIView.h b/examples/osgviewerMFC/MFC_OSG_MDIView.h index 8afac3055..2caf35d98 100644 --- a/examples/osgviewerMFC/MFC_OSG_MDIView.h +++ b/examples/osgviewerMFC/MFC_OSG_MDIView.h @@ -43,6 +43,7 @@ protected: afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnDestroy(); 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