OpenGL Interop Steps
Register a buffer object with CUDA
cudaGLRegisterBufferObject(GLuint buffObj);
OpenGL can use a registered buffer only as a source
Unregister the buffer prior to rendering to it by OpenGL
Map the buffer object to CUDA memory
cudaGLMapBufferObject(void **devPtr, GLuint buffObj);
Returns an address in global memory
Buffer must registered prior to mapping
Launch a CUDA kernel to process the buffer
Unmap the buffer object prior to use by OpenGL
cudaGLUnmapBufferObject(GLuint buffObj);
Unregister the buffer object
cudaGLUnregisterBufferObject(GLuint buffObj);
Optional: needed if the buffer is a render target
Use the buffer object in OpenGL code