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

Started by
-1 comments, last by Ishaan Singh 12 years ago
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:

__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];

}
}


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.

This topic is closed to new replies.

Advertisement