Hi,
I am trying to render texgen generated textiles in an existing VTK Render window. I followed the C++ documentation of CTKGenRenderer and based on the signature, I provided the constructor with an vtkRenderWindowInteractor. Below is a sample code
iren = vtk.vtkRenderWindowInteractor()
renderer = CTexGenRenderer(iren)
Unfortunately, this fails with the following error
renderer = CTexGenRenderer(iren)
File "D:\Anaconda2\lib\site-packages\TexGen\Renderer.py", line 369, in __init__
this = _Renderer.new_CTexGenRenderer(pRenderWindowInteractor)
NotImplementedError: Wrong number or type of arguments for overloaded function 'new_CTexGenRenderer'.
Possible C/C++ prototypes are:
TexGen::CTexGenRenderer::CTexGenRenderer(vtkRenderWindowInteractor *)
TexGen::CTexGenRenderer::CTexGenRenderer()
I am able to render the textile with the builtin vtk window as follows
renderer = CTexGenRenderer()
renderer.RenderTextile(Textile)
renderer.Start()
Also, the object returned by renderer.GetRenderer() is a SwigPyObject and not a vtkObject and, consequently I am unable to attach the rendering to another window.
My setup is : Windows 7, 64 bit, Anaconda Python 2.7 with vtk5.10.1 and Texgen 3.9 built for windows 7, 64 bit, python 2.7.
I would be grateful if you could provide with any insights/ workarounds to get this going.
Thanks
Jagir
Rendering Textile in Existing VTK Render Window in Python
Moderators: Martin, Developers
Re: Rendering Textile in Existing VTK Render Window in Pytho
Hi Jagir,
I'm not sure what the solution to this is. The rendering in TexGen is programmed in C++ using VTK and then SWIG wrapped to give the Python interface. That's why the GetRenderer function returns a SwigPyObject. You should be able to use the renderer functions to create a standalone window which will access the TexGen rendering functions by using from TexGen.Renderer import * but this wouldn't be the same as creating a window using import vtk.
Are you wanting to create a window in your own application? Could you do this by using the TexGen renderer functions?
Not sure I've been much help there...
Louise
I'm not sure what the solution to this is. The rendering in TexGen is programmed in C++ using VTK and then SWIG wrapped to give the Python interface. That's why the GetRenderer function returns a SwigPyObject. You should be able to use the renderer functions to create a standalone window which will access the TexGen rendering functions by using from TexGen.Renderer import * but this wouldn't be the same as creating a window using import vtk.
Are you wanting to create a window in your own application? Could you do this by using the TexGen renderer functions?
Not sure I've been much help there...
Louise
Re: Rendering Textile in Existing VTK Render Window in Pytho
Hi Louise,
Thanks for the input. Yes, I was trying to create a widget where both texgen and other graphical elements would render together. I was attempting to compile the software stack and look into the reasons for swig incompatibility, however with the latest visual studio building VTK 5.10 has been a challenge.
So I have given up on using the renderer. I am now using the mesh generated by texgen and loading it in my graphics windows.
Thanks
Jagir
Thanks for the input. Yes, I was trying to create a widget where both texgen and other graphical elements would render together. I was attempting to compile the software stack and look into the reasons for swig incompatibility, however with the latest visual studio building VTK 5.10 has been a challenge.
So I have given up on using the renderer. I am now using the mesh generated by texgen and loading it in my graphics windows.
Thanks
Jagir