I’m using a particle system from nvidia page as example and I’m trying to write my own. I’ve got a “segmentation fault”-error when using VBO in CUDA.
I’m trying to modify the data in vbo in some update-function, but my program crashes after the first cudaGLMapBufferObject… I’ve created an vbo before (registerGLBufferObject), but it seems, that I can’t get an access to its data.
I don’t have a lot of experience with CUDA and that’s why I can only guess, where does the problem come from. Please help me.
[codebox]
int numThreads = min(256, numBodies);
int numBlocks = (int) ceil(numBodies / (float) numThreads);
float *oldPos, *newPos;
CUDA_SAFE_CALL(cudaGLMapBufferObject((void**)&oldPos, vboOldPos)); // !!!
CUDA_SAFE_CALL(cudaGLMapBufferObject((void**)&newPos, vboNewPos));
// execute the kernel
kernel_update <<< numBlocks, numThreads >>>((float4*)newPos, (float4*)newVel,
(float4*)oldPos, (float4*)oldVel,
deltaTime,
damping,
particleRadius,
gravity
);
[/codebox]