• Advertisement
Sign in to follow this  

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

This topic is 2141 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement