Hello to all,<br><br>I'm trying to do a recording system that catches what is happening on the interactor and writes to a file. It has to be a thread or else the interactor will be unreachable while writing the movie. I've got the same error when I simplified the problem to just get a jpeg screenshot of the interactor when using threads. When I just call the method (
self.img.Write) I don't get this error msg and everything goes perfectly. Can someone tell me what's wrong with my code?<br><br> def __init__(self, parent):<br> from vtk import vtkConeSource, vtkPolyDataMapper, vtkActor, vtkRenderer
<br> # creates a dumme Cone<br> self.c = vtkConeSource()<br> self.c.SetHeight(3)<br> self.c.SetRadius(1)<br> self.c.SetResolution(10)<br> # creates a mapper with the cone<br>
self.m = vtkPolyDataMapper()<br> self.m.SetInput(self.c.GetOutput())<br> # sets the actor with the mapper<br> self.a = vtkActor()<br> self.a.SetMapper(map)<br> self.a.SetPosition((0,0,0)) # middle of the screen
<br> # puts the actor inside the renderer<br> self.r = vtkRenderer()<br> self.r.SetBackground((0,0,0)) # black bg<br> self.r.AddActor(self.a)<br> self.r.GetActiveCamera().SetPosition((10,10,10)) # camera at some position
<br><br> # set the interactor with this renderer, attached to a wx panel<br> from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor<br> self.i = wxVTKRenderWindowInteractor(self.panel
, -1 , size = self.panel.GetSize())<br> self.i.GetRenderWindow().AddRenderer(self.r)<br> self.i = interactor(self.r,self.panel)<br><br> # imaging filter<br> from vtk import vtkWindowToImageFilter
<br> self.w2i = vtkWindowToImageFilter()<br> self.w2i.SetInput(self.i.GetRenderWindow())<br><br> # the jpeg object<br> from vtk import vtkJPEGWriter<br> self.img = vtkJPEGWriter()<br>
self.img.SetQuality(80) # 80% is good<br> self.img.SetInput(self.w2i.GetOutput())<br> self.img.SetFileName('01.jpg')<br><br> def OnGetPictureButton(self, event):<br> # threading the image writing
<br> from thread import start_new_thread<br> start_new_thread(self.img.Write,()) # error<br> # this way I don't get the error msg<br> # self.img.Write()<br> event.Skip()<br><br>when "OnGetPictureButton" is called, I get this error on a pop up screen from vtk:
<br><br>"ERROR: In ..\..\VTK-5.0]\Rendering\vtkWin32OpenGLRenderWindow.cxx, lin<br>vtkWin32OpenGLRenderWindow(02FE1640): wglMakeCurrent failed in Mak"<br><br>Is it some lock issue?<br><br>thx<br>