Running OpenGL and CUDA at the same time

I have a CUDA kernel that creates data rendered by OpenGL. However, my data is too large to render it at once, so I have to split it up into a sequence. I process the sequence as follows:

[font=“Courier New”]- [Cuda Kernel for Data 0]

  • [OpenGL Renderer for Data 0]
  • [Cuda Kernel for Data 1]
  • [OpenGL Renderer for Data 1]
  • [Cuda Kernel for Data 2]
  • [OpenGL Renderer for Data 2]
  • [swap Buffers][/font]

I was wondering if I could assign some SMs to OpenGL and others to CUDA, and do some sort of interleaving between CUDA and OpenGL, i.e.,

[font=“Courier New”]- [Cuda Kernel for Data 0]

  • [OpenGL Renderer for Data 0] and [Cuda Kernel for Data 1]
  • [OpenGL Renderer for Data 1] and [Cuda Kernel for Data 2]
  • [OpenGL Renderer for Data 2] and [Cuda Kernel for Data 3]
  • [swap Buffers][/font]

Is that possible?