cudaGraphicsGLRegisterBuffer problem

Hi, anyone use CUDA+OpenGL?
I use VBO to render and use CUDA to manipluate data in VBO. It works fine if I just use cudaGraphicsGLRegisterBuffer to register vbo buffer. However, if I unregister butter by using cudaGraphicsUnRegisterResource and then register it again by using cudaGraphicsGLRegisterBuffer, the register will fail. Anyone has the same problem?

As far as I know registration should be done once for the whole application (I do it in such a way). Why do You need to unregister?

MK

Thanks for your reply. Since I am using VBO to accelerate my rendering and sometimes I need to reset the VBO content (VBO size has been changed too), I have to unregister cudaresource and recreate a new VBO and re-register it to cuda.

VBO has proper functionality for being dynamically changed, doesn’t it? How do You pass the buffer reference to the kernel (launch argument or through global device pointer somewhere in the code)? Could You provide some code, maybe? In my code for instance, I do it with the argument (see the code if You like, though it is driver API).

MK