arrayfire / forge

High Performance Visualization
221 stars 48 forks source link

Render directly from GPU #234

Closed rish-joshi closed 2 years ago

rish-joshi commented 2 years ago

Hi , I have a simple question . Let's say I have an array on the device, and I apply some operations on it.

__device__ float positions[10'000];
__device__ float dx = 0.01;

__global void updatePositions() {
    int id = threadIdx.x + blockIdx.x * blockDim.x;
    positions[id] = position[id] + positions[id] * dx;   // Basically this is an ODE.
}

/* Now draw this array using forge */

Now, I want to directly draw this array as it is already located in the GPU. Is it possible to do so ? if yes, how can I do that . I would love to do that.

9prady9 commented 2 years ago

@RiShAbHjOsHibot Did you check the CUDA examples ?

rish-joshi commented 2 years ago

I had no idea that I would be able to do this . Thanks ! I have other question too !

9prady9 commented 2 years ago

I can't recollect right away, but I think color map can only be set for images at the moment. Check https://github.com/arrayfire/forge/blob/master/examples/cpu/histogram.cpp example for an idea. I don't think surfaces has this yet, but I would have to check to confirm this.

rish-joshi commented 2 years ago

Hi, I was just scrapping the internet and I found https://github.com/datoviz/datoviz . I shouldn't say this but, is it possible to integrate these two libraries ? The difference is OpenGL and Vulkan respectively. It has many interesting features too !

This is just a question of interest

9prady9 commented 2 years ago

@RiShAbHjOsHibot Sorry couldn't respond immediately. I wouldn't know right away how easy it would be to integrate these two. I have never used this library earlier to this date. Forge intends to have Vulkan Backend, but it would also function similar to the current OpenGL backend, only providing shader based rendering logic. From quick looks, Datoviz seems like a full fledged framework/library to render data. It seems, to me, like goals/approach of these two projects aren't exactly the same even though they do render things in the end.