[vtk-developers] Possibly error with vtkProgrammableFilter in Activiz Wrapper

Benjamin Jähn jaminus_jahnatos at freenet.de
Sat Jan 5 11:35:39 EST 2013


Hello all,

I try to use the vtkProgrammableFilter with Activiz but I cant't get it 
to work. I studied the examples for other wrapper languages and it seems 
to be very easy there. That's why I think there is maybe a bug in the 
Wrapper for Activiz.
I used the latest precompiled binaries of Activiz (ActiViz .NET 
OpenSource Edition 5.8.0 (Windows XP or later)).

Please have a look at the following example which basically shows what I 
want to do. Whenever I run the code my function is called but 
nevertheless the application crashes.
What am I doing wrong or is there maybe a bug in the wrapper?

Thanks in advance!
Regards!

using System;
using Kitware.VTK;

namespace ProgrammableFilter
{
     class Program
     {
         public static vtkProgrammableFilter ProgFilter = 
vtkProgrammableFilter.New();

         public static void ProgrammableFunction(System.IntPtr arg0)
         {
ProgFilter.GetPolyDataOutput().ShallowCopy(ProgFilter.GetPolyDataInput());
             Console.WriteLine("Programmable!");
         }

         public static void Main(String[] argv)
         {
             vtkSphereSource Sphere = vtkSphereSource.New();
             Sphere.SetPhiResolution(100);
             Sphere.SetThetaResolution(100);

             //vtkProgrammableFilter
ProgFilter.SetExecuteMethod(ProgrammableFunction,IntPtr.Zero);
             ProgFilter.SetInputConnection(Sphere.GetOutputPort());

             vtkPolyDataMapper Mapper = vtkPolyDataMapper.New();
             Mapper.SetInputConnection(ProgFilter.GetOutputPort());

             vtkActor Actor = vtkActor.New();
             Actor.SetMapper(Mapper);
             Actor.GetProperty().SetRepresentationToSurface();

             vtkRenderer Renderer = vtkRenderer.New();
             Renderer.AddActor(Actor);
             vtkRenderWindow RenderWindow = vtkRenderWindow.New();
             RenderWindow.AddRenderer(Renderer);
             RenderWindow.Render();

             vtkRenderWindowInteractor Interactor = 
vtkRenderWindowInteractor.New();
             Interactor.SetRenderWindow(RenderWindow);

             Interactor.Initialize();
             Interactor.Start();

             Console.ReadKey();
         }

     }
}



More information about the vtk-developers mailing list