Display vertices stored in cuda using opengl

Hi all, I’m new to the boards – first post. Ok, so I’ve got an array of structs representing a particle. The struct stores position and speed. All the movement calculations are done on the device, then I must copy the array back to the host and loop through it to draw each particle using glVertex3f().

I’ve been reading about Vertex Buffer Objects, and found a function called cudaGLMapBufferObject(). It seems like you should be able to access a Vertex Buffer Object from cuda, manipulate the vertices, then draw the buffer using opengl. That would avoid the transfer of data between host and device, as well as the O(n) operation of drawing each vertex from the host using glVertex3f().

I just can’t seem to put the pieces together to make this happen. Any help would be greatly appreciated. Also, I can post a code sample later – I’m posting from my phone right now.