Sign in to follow this  
Ishaan Singh

Trying to generate data in a vbo using CUDA.. Help please

Recommended Posts

Ishaan Singh    100
Hi

I'd like to ask.. Im trying to build a cuda-gl code that replicates the data present in the vbo and perturbs it by a little bit (just to see if this is working). The end goal is to tessellate uniformly using cuda-gl.
I have a vbo which is twice the size of the mesh currently. I'm spawning numFaces*3 cuda threads (one for each vertex) and would like each thread to copy the data present in the vertex corresponding to the x = blockID.x*blockDim.x + threadID.x into x+mesh_size and add a little offset to the x coordinate. the kernel looks like this:

[code]__global__ void kernel(float3* pos, float3* norm, unsigned int mesh_size, float time)
{
unsigned int x = blockIdx.x*blockDim.x + threadIdx.x;

time=time;
if(x<mesh_size)
{
pos[x+mesh_size]=pos[x];
pos[x+mesh_size].x += cosf(time);
norm[x+mesh_size]=norm[x];

}
} [/code]

The kernel has as input, two vbos, one for positions, one for normals.

The problem is that, if the above code works, i should ideally see two objects, one static and one moving, but I only seem to be able to see the first half of the vbo, ie. a single copy of the mesh.

Any help would be greatly appreciated as we're working on a deadline by our professor.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this