[vtkusers] VTK Java/C Wrapping/Coding Problem

Luke Dodd i.like.bread at gmail.com
Thu Aug 12 16:52:10 EDT 2010


Hi Ambar,

If you look in vtkObjectBase.java (will only exist after comping vtk,
in the build directory - not the source) you will see that it has a
(protected) field called vtkId. This is essentially a C pointer to the
vtk object the java object is wrapping. If you retrieve value and get
it into C++ with a few horrible casts you could have a pointer to the
object. You'll have to work around trying to get the protected field -
this is possible in java (google it) or you could tweak
vtkObjectBase.java (this is annoying because vtk object base is
generated when building).

Hopefully that should be enough to get you started. If you need more
detailed help just ask.

Best Wishes,
Luke

On 10 August 2010 23:12, Ambar C <ambarc at gmail.com> wrote:
> Hello VTK users,
>
> I currently have a project that's in both Java and C++, and part of
> the project involves a wrapper using the Java Native Interface (JNI)
> where I use functionality from my C++ libraries in the Java code.
>
> Now the problem that I face is, both my Java and C++ codes use VTK
> objects - and when I pass down, say a vtkPolyDataAlgorithm object
> created in Java through to the C++ code, I'm not quite sure how to
> cast/use it.
>
> Please feel free to ask any questions that would help you to answer my question.
>
> Best Regards,
> Ambar
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list