[vtkusers] No depth buffer with wxVTKRenderWindow and wxVTKRenderWindowInteractor (FIX?)

Peter Clifton pcjc2 at cam.ac.uk
Thu Dec 6 18:35:48 EST 2007

I've chased the depth buffer issue I was having some more (perhaps about
as far as I've got time to), and conclude there is some bug in the
interaction between wxVTKRenderWindow.py or
wxVTKRenderWindowInteractor.py and the VTK GL class underneath.

It seems that the widget is re-parented (or that code is invoked) when
the widget first comes into existence, and after this point, the GL
visual in use doesn't have a depth buffer.

I'm not sure if the wrong visual is being used after re-parenting
(visuals are part of X11 which I don't really understand), but debug
tests I added before / after the re-parenting lead me to suspect this is
where the depth buffer functionality disappears.

I don't know why this helps, but looking at the old code for VTK from
wxwidgets, I tried:

--- wxVTKRenderWindowInteractor.py.bak  2007-11-30 02:28:36.000000000 +0000
+++ wxVTKRenderWindowInteractor.py      2007-12-06 23:30:41.000000000 +0000
@@ -321,7 +321,7 @@
             # store the handle
             self.__handle = self.GetHandle()
             # and give it to VTK
-            self._Iren.GetRenderWindow().SetWindowInfo(str(self.__handle))
+            self._Iren.GetRenderWindow().SetParentInfo(str(self.__handle))
             # now that we've painted once, the Render() reparenting logic
             # is safe

And the problem is fixed.

I don't expect for a second that this is the right fix, but as I don't
understand the subtlties of the VTK rendering class and have not used
wxWidgets before, I think it's best to pass this on for for VTK
developers to look at fixing.

Many thanks for the debugging suggestions along the way.

Best wishes,

Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,

Tel: +44 (0)7729 980173 - (No signal in the lab!)

More information about the vtkusers mailing list