Cuda/OpenGL

Hi guys,

I need a cuda kernel that compute data from an OpenGL Frame Buffer Object (as GL_TEXTURE_2D_ARRAY with 2 level) and to put the results in another frame buffer object. I tryed to use :

cudaGraphicsGLRegisterBuffer
cudaGraphicsMapResources
cudaGraphicsResourceGetMappedPointer

mykernel<<<>>>()

cudaGraphicsUnmapResources
cudaGraphicsUnregisterResource

For both of my FBOs. But it dont works at all.
How to do this nicely?

The cuda/OpenGL interop sample codes may be of interest. They demonstrate use of VBOs and PBOs directly as I recall.

Using a FBO is a little more complicated as we are still usually using a resource (e.g. texture resource) associated with the FBO, as our interop vehicle. There are treatments of this in various places, such as here:

http://www.3dgep.com/opengl-interoperability-with-cuda/

This sample code demonstrates use of a 3D volume texture associated with a FBO:

https://github.com/nvpro-samples/gl_cuda_interop_pingpong_st