unmapping and using buffer in opengl while registered in CUDA

hi

i have a few buffers that i register with Cuda using cudaGraphicsRegisterResource. I then map it and use it with cuda (using cudaGraphicsMapResource) and then I unmap (using cudaGraphicsUnmapResource) it and try and use it with one of opengl’s shaders. Note : at this time , i have unmapped the buffer but not unregistered it with cudaGraphicsUnregisterResource. After the opengl shader run, I then map it again using cudaGraphicsMapResource and then runit through Cuda.

I am running into a cudaError_t memory exception error, complaining it cannot access a memory location.

Note: I am also using Visual Studio 2008 .

I am wondering if this truly a memory access location error or error arising because i am switching between opengl and cuda, even though i am using cudaGraphicsMapResource/cudaGraphicsUnmapResource.