I'm new to both VTK and C#, and I want to use the GetScalarPointer() function, which returns an IntPtr. Is this possible, and if so, what do I assign the return value to so I can use it? If someone could post a code snippet it would be much appreciated.
Thanks,
Jerry
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
GetScalarPointer returns a pointer to int in C++. As you say, the wrappers convert this to an IntPtr, but it is nothing like an int*, despite the name. It's just the C# type for data types you can't do anything with.
It might be possible to cast the IntPtr to an unsafe int* in C#. I didn't do anything special for such pointers in the wrappers because the DataSet allows you to access its contents without using the bare pointer, and VTK provides this access specifically for wrappers to use. It's slower, but it may be the price to pay.
Drew
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm new to both VTK and C#, and I want to use the GetScalarPointer() function, which returns an IntPtr. Is this possible, and if so, what do I assign the return value to so I can use it? If someone could post a code snippet it would be much appreciated.
Thanks,
Jerry
Hi Jerry,
GetScalarPointer returns a pointer to int in C++. As you say, the wrappers convert this to an IntPtr, but it is nothing like an int*, despite the name. It's just the C# type for data types you can't do anything with.
It might be possible to cast the IntPtr to an unsafe int* in C#. I didn't do anything special for such pointers in the wrappers because the DataSet allows you to access its contents without using the bare pointer, and VTK provides this access specifically for wrappers to use. It's slower, but it may be the price to pay.
Drew