Buggy V3d_View::Redraw & Black Screen

Hi, everybody:

When I switch between different maximized MDIChildWnd using Ctrl+Tab key, the screen is black! sometimes moving mouse or LBUTTON click mouse it will disappear, but often it won't!

You can easily reproduce this bug in any MFC samples provided with OCC 4.0.
Due to each switch between different maximized MDIChildWnd using Ctrl+Tab key, my debug code show the corresponding V3d_View::Redraw ( in CView::OnDraw ) is calling, I think this is a OCC bug.

I often find other bug about redraw of OCC under Windows platform. especially some portion of client area is black.
I hope someone can tell me how to avoid this problem. Any workaround is highly appreciated.

Stephane Routelous's picture

Hi,

I think it is an MFC or a Windows problem and not an OCC one.
OCC has nothing to do with Ctrl+Tab or updating your window.
When the window has to be repaint, just send a redraw to the 3d view.
You can try to catch the WM_SETFOCUS, OnActivateView, WM_SHOWWINDOW or something like that.

My idea is that the error is in the sample, and not in OpenCASCADE itself.

fhchina's picture

Hi, Stephane:

I am afraid I will not agree with you. As far as I know, OCC provides a cross-platform Windows drawing mechanism. In other words, this V3d_View::Redraw will work both on MFC/Windows & X Window. But I dived into the source of OCC, I found it more X window based while not MS Windows based.

The most important proof on my point is YOU CAN EASILY FOUND MANY PROBLEMS ON MFC SAMPLES SHIPPED WITH OCC4.0 ABOUT REDRAWING.

For example, when several child framewnd cascaded in a MDI sample application, the one hidden by another will be black often.

I think the support to redrawing corresponding WM_PAINT/WM_SIZE/WM_ERASEBACKGROUND is not enough due to OCC is more based on X Window mechanism! I insist that it should be a OCC bug.

But your suggestion is still valuable. I will try some workarounds if there is no direct solution about this bug.