Thread: [wxVTK] Redraw problems with wxVTK and wxMAC: perhaps a solution!
Brought to you by:
malat
From: Pierre F. <Pie...@so...> - 2007-02-19 14:22:42
|
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. |
From: Sander N. <nie...@st...> - 2007-03-15 13:50:09
|
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 |
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 |
From: Sander N. <nie...@st...> - 2007-03-15 14:22:51
Attachments:
wxVTKRenderWindowInteractor.cxx.patch
|
Hi Mathieu, The attachement gives the diff between my version and version 1.2. |
From: Mathieu M. <mat...@gm...> - 2007-03-15 23:24:01
|
$ cvs ci -m"ENH: Fix issue reported by Pierre Fillard and Sander Niemeijer on wxVTK mailing list. Applying temporary patch for now until better solution. Thank you both" wxVTKRenderWindowInteractor.cxx Checking in wxVTKRenderWindowInteractor.cxx; /cvsroot/wxvtk/wxVTK/src/wxVTKRenderWindowInteractor.cxx,v <-- wxVTKRenderWindowInteractor.cxx new revision: 1.31; previous revision: 1.30 done thanks ! -Mathieu On 3/15/07, Sander Niemeijer <nie...@st...> wrote: > Hi Mathieu, > > The attachement gives the diff between my version and version 1.2. > > > > This patch also introduces a wxCHECK_VERSION for the inclusion of wx/ > gtk1/win_gtk.h. > The split between gtk1 and gtk as directories for gtk1 and gtk2 is > only a recent change in wxWidgets (I am not entirely sure whether the > switch was with version 2.8.0. It could also have been some 2.7 > release that introduced this split). > If you want to be compatible with earlier versions of wxWidgets > (using GTK 1.2) having an #ifdef like in the patch will be needed. > > Best regards, > Sander > > On 15-mrt-2007, at 15:01, Mathieu Malaterre wrote: > > > 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 > > > > -- Mathieu |