[vtkusers] Problem with vtkTkRenderWidget and CrystalEyes stereo
j.m.h.thomas at dl.ac.uk
Fri Jun 30 07:13:30 EDT 2006
I'm trying to get vtk to use CrystalEyes stereo with a
vtkTkRenderWidget, but am hitting a problem in that the render window I
create is not stereo capapble, and I therefore get the error message:
vtkXOpenGLRenderWindow (0x8351740): Adjusting stereo mode on a window
that does not support stereo type CrystalEyes is not possible.
I call vtkTkRenderWidget with the "stereo=1" flag to generate a widget
with a renderwindow that is stereo capable, and then call the
GetRenderWindow method on the widget to get the RenderWindow. However,
the RenderWindow I get back is not stereo capable, as illustrated by the
error message above. This is despite the fact that the window that is
initially created within vtkTkRenderWidget is stereo capable.
I checked this with a print statement in the file:
at line 89, where it checks the keyword dictionary as shown below:
try: # was a stereo rendering context requested?
print "Setting stereo"
At the point of the print statement, the window is stereo capapble.
It therefore seems that the window returned by the GetRenderWindow is
not the same one as was first created.
If I create the render window directly, and avoid the vtkTkRenderWidget
side of things, it appears to work o.k.
I've pasted in an example below that demonstrates the problem - setting
the tk variable to 0 or 1 turns off the Tk code and shows that it
appears to work if you don't use the vtkTkRenderWidget code.
Any suggestions/help would be greatly appreciated.
from Tkinter import *
from vtk import *
from vtk.tk.vtkTkRenderWidget import *
# Set the tk variable to 0 to eschew the Tk code
# Make a root window
root = Tk()
# Add a vtkTkRenderWidget
renderWidget = vtkTkRenderWidget(root,stereo=1)
# Get the render window from the widget
renWin = renderWidget.GetRenderWindow()
print "renWin is"
renWin = vtk.vtkRenderWindow()
print "renWin is"
iren = vtk.vtkRenderWindowInteractor()
# Next, do the VTK stuff
ren = vtkRenderer()
cone = vtkConeSource()
coneMapper = vtkPolyDataMapper()
coneActor = vtkActor()
# start up the event loop
More information about the vtkusers