OpenGL Interop

Hi,

I do some calculation on a 2D float array on the GPU and would like to display the results of the computation via OpenGL. I’d like each float value to be associated with a grey-value in the display.
I know that there are a lot of OpenGL Interop examples in the SDK but I find them very confusing and don’t really know how to approach the problem. Could someone with more OpenGL experience than myself maybe outline the steps necessary to do this or point me to an example where something similar is done?

Any help would be greatly appreciated.
Seb

There are a few slides on interop here:
http://www.isi.edu/~ddavis/GPU/Course/Slid…s%20interop.pdf

Paulius

Hi Paulis,

thanks for the hint. I already found an example that does basically what I want: the boxFilter example.

However I ran into a problem: I have the OpenGL context (window) in one thread and do the CUDA computation in another thread. I would like those two to interop.

My basic idea was to create the PBO in the OpenGL context and use it as global memory in the CUDA context (calling cudaGLMapBufferObject) but it doesn’t seem to work so far. Is what I try to do possible (which would mean I have an error somewhere else) or is it impossible?

Thanks in advance,

Sebastian

Nope, I think it’s not. At least it wasn’t possible to share a context between threads at the time of CUDA 1.0. And I don’t remember any mention of this with the release of 1.1 and the lastest driver. But I haven’t tried since.

Both the OpenGL and CUDA contexts must be associated with the same CPU thread. So, it is not currently possible to do what you’re trying to do.

Paulius