I thought I'd have a go at compiling the readybase project into a lib or dll to use in other projects, however its quite the task trying to unravel it into a single lib or dll given all the VTK integration it appears to have.Anyone managed to successfully do this?
Okay I've successfully managed to get AbstractRD working in an external DLL and project. I had to just copy n paste the huge amount of linked vtk libs into the project and let it sort itself out. :P
Can you tell me a bit more about how AbstractRB works? I've used the SystemFactory::CreateFromFile() method to load in a pattern just like the rdy project. But I'm not really sure how to then look around in the data as I update().Its not clear what SaveFile() outputs as either.
For all the current calculations I want to perform I'd like more direct access to the data so I can look at individual gridpoints or pull out entire blocks of the data. I'd rather not introduce any extra latency by pushing the data to image and then grabbing that and read it.
On the subject of images though: I was doing
You should only need the five VTK libs listed in the CMake file.
You could use AbstractRD::GetValue() to retrieve individual pixels. (On image data it gives the closest pixel. On mesh data it gives the nearest cell.)
If you want to access the whole image more quickly you could try a dynamic_cast from the AbstractRD to ImageRD, and then use ImageRD::GetImage(int iChemical).
In between updates, ImageRD pulls the data off the GPU back into the vtkImageData storage, which you can directly access by using GetValue() which calls ImageRD::GetImage(int iChemical), so there's no unnecessary copying beyond what we do anyway. (In theory we could leave the data on the GPU and render directly from there somehow I think but I don't know how to do that.)
On the subject of images though: I was doing
I think you accidentally
You should only need the five VTK libs listed in the CMake file.Unfortunately not - At least vtkImage was required, plus more. Its okay. The compiler will only link what I'm using.
You could use AbstractRD::GetValue() to retrieve individual pixels. (On image data it gives the closest pixel. On mesh data it gives the nearest cell.)
Okay yeah I saw that. That will be fine.
If you want to access the whole image more quickly you could try a dynamic_cast from the AbstractRD to ImageRD, and then use ImageRD::GetImage(int iChemical).Great I'll give that a go.
In between updates, ImageRD pulls the data off the GPU back into the vtkImageData storage, which you can directly access by using GetValue() which calls ImageRD::GetImage(int iChemical), so there's no unnecessary copying beyond what we do anyway. (In theory we could leave the data on the GPU and render directly from there somehow I think but I don't know how to do that.)
Yeah actually are you able to provide any information on how you're rendering the meshes? I've spent some time digging around and have seen that you use vtk to generate the surface and store the mesh there. My main question is whether you keep it all on the GPU or do you copy the data back, generate the mesh, then push the mesh back to the GPU for rendering?
On 19 January 2013 14:19, Scott Richmond <s.t.ri...@gmail.com> wrote:
You should only need the five VTK libs listed in the CMake file.Unfortunately not - At least vtkImage was required, plus more. Its okay. The compiler will only link what I'm using.
Do you mean vtkImaging.lib? Not sure why it would be needed, if we can link Ready without it. Maybe the other libs include it somehow?
You could use AbstractRD::GetValue() to retrieve individual pixels. (On image data it gives the closest pixel. On mesh data it gives the nearest cell.)
Okay yeah I saw that. That will be fine.
Ah hrm. So I'd have to pull the entire image? I'd like to get direct access to the array that holds the latest after getting back from the GPU if possible. I assume doing a GetImage will make a local copy of the array every time I call it. Could be wasteful.
On 19 January 2013 15:06, Scott Richmond <s.t.ri...@gmail.com> wrote:Ah hrm. So I'd have to pull the entire image? I'd like to get direct access to the array that holds the latest after getting back from the GPU if possible. I assume doing a GetImage will make a local copy of the array every time I call it. Could be wasteful.
No, ImageRD::GetImage(int iChemical) returns a pointer, no copying.
http://code.google.com/p/reaction-diffusion/source/browse/trunk/Ready/src/readybase/ImageRD.cpp#149
(There's another function ImageRD::GetImage(vtkImageData *im) that copies the chemicals into a multi-channel image but you don't need that one.)
Well I think Ready is a really cool tool. But it probably needs to be a bit more API friendly.If you want a big goal to start with I'd say to pull VTK out of readybase, if you can. I assume that when you pull data back from the GPU its in the form of float arrays and not any form of image array. If so then decoupling it would be best as its an unneeded requirement.I understand that is a tall order however, given how much VTK code you have in there.
In the short-term it would be nice to be able to get as close to the data as possible.I'd also like to see some form of event callback when new data has just been pulled from the GPU, otherwise I think I'll be blindly checking in a loop. Its a bit wasteful.