using/extending VTK via Java ?

Ken Martin ken.martin at kitware.com
Sat Feb 19 15:44:58 EST 2000


>[I sent this earlier in the week but the VTK mailing list seemed
>to be down forseveral days.  Just saw a msg come through,
>so I'll try again .....]

The mailing list has been moved. The old may still be functioning but you 
should now use vtkusers at public.kitware.com

         Generic Warning: In vtkJavaUtil.cxx, line 381
>            GetPointerFromObject: vtk bad argument, type conversion failed
>
>General simplification/overview of code:
>
>         // MyImplicitFunction derived from vtkImpliciFunction w/ required 
> functions
>         MyImplicitFunction bmodel = new MyImplicitFunction();
>             //code to populate bmodel here
>
>         vtkSampleFunction sampleblob = new vtkSampleFunction();
>         samleblob.SetImplicitFunction(bmodel);
>
>The above internal addressing error occurs when I first try to use bmodel
>in vtkSampleFunction.
>
>If I use a pre-defined function such as vtkSphere (instead of 
>MyImplicitFunction)
>everything works fine. In fact, if I extend a vtkSphere, to make my own 
>class,
>it also works fine.
>
>Now, here's where I'm starting to think  my problem may be.
>Remember, I'm using the Java interface here.
>
>Do I also have to implement the vtkImplicitFunction extended class
>(i.e. MyImplicitFunction.cxx) in C++ and then wrap it with JNI
>in order to extend the Java class? I have only extended the Java class.
>My guess is tha the above error is stemming from a failure to find
>a MyImplicitionFunction object address within the C++ naming space.
>
>Can you extend VTK classes via Java without also supplying the C++

You must implement your class as a C++ class, except if you are using the 
vtkProgramableFilter and related classes. In your case you must create a 
C++ subclass of vtkImplicitFunction, build VTK with that new class added 
and then you should be fine. The issue is that the calculations are all 
done in pure C++ code and there is no opportunity for the C++ code to 
invoke GetValue or GetGradient of a Java class without having the C++ 
classes interface to Java in a more invasive manner.

- Ken

--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list