I'm trying to implement a point cloud with OpenGL and CUDA, where the radii of the points shall vary in size over time, based on some data associated with them.
Since I'm completely new to OpenGL AND CUDA, I'm having a pretty tough time achieving this goal. After learning the basics of OpenGL, GLSL and CUDA, I'm completely confused about which parts of the program should be achieved how.
My idea was the following:
- Use a VBO with vertex positions
- Use a VBO with vertex radii
- Use a VBO with vertex uncertainties. Based on this data, the radii of the vertices shall vary in an animated manner
- Compute the radius of all the vertices in a CUDA kernel each frame
- Call glDrawArrays to render all the points and use a vertex shader, which gets all the data from the arrays as input
First of all...it is reasonable to use CUDA and GLSL shaders together for this purpose? Since I've read some things about using either one or the other, I'm not sure about that.
The second question is, which parts of the program would be executed on the CPU and which on the GPU? Does it make sense to calculate data in a kernel and then pass it back to the OpenGL display function to render it?