GLMapBufferObject & copying from VBO to GPU's other part of memory?

I have sth like:

//in class:

glGenBuffers(1, &cVBO_vertices);

glBindBuffer(GL_ARRAY_BUFFER, cVBO_vertices);

glBufferData(GL_ARRAY_BUFFER, cVBO_numberVertices*3*sizeof(GLfloat), (GLfloat*)points, GL_DYNAMIC_DRAW);



cudaMalloc((void **) &dataGPU, size);

cudaGLMapBufferObject((void**)&dataGPU, myVBO.cVBO_vertices);

//CUDA calculations



I do calculations using dataGPU (not myVBO.cVBO_vertices). Is the data copying from VBO to allocated memory? Is possible to do it directly using VBO?

You don’t need to call cudaMalloc, the memory has already been allocated in the VBO. cudaGLMapBufferObject just makes sure the VBO is in GPU memory and returns a GPU pointer to it, there is no copy.

void *dataGPU;

cudaGLMapBufferObject((void**)&dataGPU, myVBO.cVBO_vertices);