OpenGL & GPU Interaction

Dear all:
I have no idea about communication with OpenGL & CUDA. If I want to get the data of GPU to do something with OpenGL, how do they work? Does CPU need to get the data from GPU firstly and then call OpenGL to get it ? :) Thanks!!

I’m not so sure but maybe section 4.5.1.3 / 4.5.2.5 (4.5.2.7 v1.1) of the programming guide 1.0 gives you the answer?

Thanks for your answer… External Image
I have read about this function, but I have no idea to use this!
Does anyone have sample code or something that I can understand easily!!
Thanks a lot!! :)

There are several samples in the SDK that use OpenGL interop, like box filter, convolution, post process GL, simple GL, etc.

The basic procedure is to map a OpenGL buffer to CUDA, have it work with data (or fill it with data), and then unmap back so OpenGL can normally access it.

Also the FluidsGL example in the SDK can maybe help you out. This is CUDA with I think OGL.

Thanks both of you !!! External Image
Maybe I need to trace the code and understand it!!
Thanks a lot !!
External Image