Re: [wxVTK] Redraw problems with wxVTK and wxMAC: perhaps a solution!
Brought to you by:
malat
From: Mathieu M. <mat...@gm...> - 2007-03-15 14:01:50
|
Sander/Pierre, Could one of you send me either a patch or the full cxx source, so I can apply it. I will not have access to a mac for a while. Thanks -Mathieu On 3/15/07, Sander Niemeijer <nie...@st...> wrote: > Hi, > > I would like to confirm the problem and work around. > > I had the same problem using wxWidgets 2.8.1.1 (carbon build), VTK > 5.0.2 and MacOSX 10.4.9. > > For me the problem also appeared when using a wxSplitterWindow. > However, I only used one part for the VTK window and the other part > of the splitter contained a panel with some control buttons. When > resizing (i.e. enlarging the window) the part in the VTK window that > did not get updated (and contained a background color) was the area > where the panel with control buttons was _before_ resize. > > The workaround with the UpdateGLRegion() did fix the problem (thank > you Pierre!). > I only doubt whether this fix is good final solution to the problem. > To me it seems that something more fundamental is wrong somewhere > inside either wxWidgets or VTK. > > By the way, I also had to add > --- > #ifdef __WXMAC__ > #include "vtkCarbonRenderWindow.h" > #endif > --- > to the top of the file for the definition of vtkCarbonRenderWindow. > > Best regards, > Sander > > On 19-feb-2007, at 15:21, Pierre Fillard wrote: > > > Hi! > > > > First of all, thank you Mathieu for providing us with this wx > > interface > > to VTK! > > > > Since I started using wxWidgets and wxVTK on a MAC, I realized (others > > might have experienced this also) that the display was sometimes not > > updated properly. I am using wxMAC 2.8.0, VTK 5.0.2 and MacOSX > > 10.4.8. I > > used wxVTK versions from 0.8 to 1.2, the problem remains in all > > versions. > > > > The problem occurs when at least two wxVTK windows are embedded in a > > window (case of the SplitSample for example). > > > > When one slowly resizes it, there is no problem, i.e. everything is > > repainted correctly. However, when one resizes the window very fast, > > (for instance when the window is put in full screen mode), then some > > parts of the wxVTK windows are not redrawn, even worse, the background > > is painted over the window. The only way to refresh the wxVTK > > windows is > > to slowly downsize the frame. I tried to overload the OnPaint event to > > force a call to Render() or simulate a resizing, nothing worked. > > > > It was starting to drive me crazy since the redraw problem was really > > annoying when one wanted for instance, to put a view in full > > screen, and > > then back to normal... > > > > I finally found a solution: one needs to call the "UpdageGLRegion()" > > method of the vtkCarbonRenderWindow (assuming that you're using the > > Carbon version of wxMAC, I haven't tried the other ports, but they > > seem > > to be less complete anyway) during the OnPaint() method of the > > wxVTKRenderWindowInteractor class. Here is what I put at the end of > > the > > OnPaint() method: > > > > #ifdef __WXMAC__ > > vtkCarbonRenderWindow* rwin = > > vtkCarbonRenderWindow::SafeDownCast(RenderWindow); > > if( rwin ) > > { > > rwin->UpdateGLRegion(); > > } > > #endif > > > > That might not be the most elegant way to bypass this redraw problem, > > but at least it works. And goodbye the ugly background painted over > > the > > VTK windows. > > > > I hope this was helpful to some Mac users. Maybe the problem is > > completely related to my hardware / software version. In this case, I > > apologize for the inconvenience. > > > > Pierre Fillard, > > INRIA Sophia Antipolis, France. > > http://www-sop.inria.fr/asclepios/software/MedINRIA. > > > > > > ---------------------------------------------------------------------- > > --- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to > > share your > > opinions on IT & business topics through brief surveys-and earn cash > > http://www.techsay.com/default.php? > > page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Wxvtk-users mailing list > > Wxv...@li... > > https://lists.sourceforge.net/lists/listinfo/wxvtk-users > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Wxvtk-users mailing list > Wxv...@li... > https://lists.sourceforge.net/lists/listinfo/wxvtk-users > -- Mathieu |