[vtkusers] RE: [wxPython] VTK + wxPython flicker issue on Linux/GTK.

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Fri Mar 9 02:57:05 EST 2001


>>>>> "David" == David D Marshall <gte552m at prism.gatech.edu> writes:

    David> Are you using the updated wxVTKRenderWindow code from
    David> http://www.prism.gatech.edu/~gte552m/wxVTKWindow.html?  I
    David> just tried it with this code (actually slightly modified)
    David> and could set my wxFrame to wxSize(150, 140) and
    David> wxSize(450, 340).  I also could not get the column of
    David> pixels problem on the right either.  Perhaps we are talking
    David> about different wxVTK packages because there are a few :(.

    David> As for Prabhu's original flicker question, perhaps you
    David> could take a look at the wxVTKRenderwindow code mentioned
    David> above and back-port it to python.  I am not skilled in
    David> this, but from what I remember of the wxPython-VTK code it
    David> was similar to the above c++ class wxVTKWindow.

Well, I just got the latest wxwindows version and got it
compiled for debian.  I got the sources from woody and managed to get
them compiled on my potato box.  wxwindows seems to work okay.  The
flicker problem with python is still there.  

In order to test David's C++ wxVTKRenderWindow code I compiled the
stuff and ran both the Sample_gtk and the SplitSample_gtk test
programs without making any modifications to wxVTKWindow.cpp.
Unfortunately, both of them flicker quite a bit! :( Even if I just
rotate the cone by a small amount, slowly, it is clear that there is

None of my other VTK-Python code flickers like this.  The standard
Cone.py example works, so does all my other code (and i have quite a
bit of it).  I have a hardware accelerated card - so it is likely that
I am able to see the flicker.  This also explaine Marco's experiences
of seeing flicker on the SGI machines.

I then looked at the VTK list archives and some of my saved messages
and found that Renaud KERIVEN <keriven at cermics.enpc.fr> mentioned that
replacing SetWindowId by SetParentId fixes the flicker problem.  I did
just that and it fixed the problem with your C++ wxVTKWindow class.  I
also tried removing the SetDisplayId part and that worked fine too.
Hence here are some modfications that I suggest for your class (this
is valid only for WXGTK since I cant test on any other platform):

      (1) You dont need to set the DisplayId.  This can be safely

      (2) Replace the SetWindowId to SetParentId - this removes all
      the flicker.

      (3) You shouldnt set the Parent Id each time you do OnPaint.  if
      you do this then when I resize the programs window I get error
      messages from VTK like so:

        $ ./Sample_gtk 
	ERROR: In vtkXRenderWindow.cxx, line 223
	vtkOpenGLRenderWindow (0x80cc5d0): ParentId is already set.

	ERROR: In vtkXRenderWindow.cxx, line 223
	vtkOpenGLRenderWindow (0x80cc5d0): ParentId is already set.

      etc. etc.
This should hopefully fix the flicker problems with the wxVTKWindow

It appears to me that if a similar approach is taken with the Python
class the flicker with the Python code can also be eliminated.  I
propose to add a member function to the vtkXRenderWindow and
vtkWin32OpenGLRenderWindow classes called SetParentInfo() which works
just like SetWindowInfo.  Hopefully, by using this instead of the
SetWindowInfo the flicker can be completely eliminated.  I will let
you folks know how it goes.


More information about the vtkusers mailing list