I have a serious problem with mapping a VBO from OpenGL to CUDA. That’s the code:
// create buffer object
// initialize buffer object
unsigned int size = 256 * 256 * 4 * sizeof( float);
float data = (float)malloc(size);
glBufferData(GL_ARRAY_BUFFER, size, data, GL_DYNAMIC_DRAW);
err = cudaGLRegisterBufferObject(vbo);
err = cudaGLMapBufferObject((void**)&dptr, vbo);
// Call a kernel
err = cudaGLUnmapBufferObject(vbo);
err = cudaGLUnregisterBufferObject(vbo);
That’s almost identical with the simpleGL example from the SDK. All error codes are cudaSuccess but after this code is executed my computer hangs for a few seconds. No interaction at all possible. Then I get back control for a moment but shortly after it hangs again. Also my OpenGL viewport (interactive 3D walkthrough) is totally messed up. My scene is rendered with flickering artifacts or not all. When I comment out cudaGLMapBufferObject and cudaGLUnmapBufferObject everything works fine. Also the SDK samples run perfectly good. I’m really desperate and out of ideas. Is there any way to find out what’s going wrong?
Thanks for any help in advance.
Intel Core2 Duo
4 GB RAM
MS VS 2005