It might be better to ask similar questions on the PyCUDA mailing list,
Also - sorry it took so long to get to your email
On Tue, 2016-06-07 at 22:11 +1000, Lars Andersson wrote:
I was wondering if you could give me a quick summary of what is
currently the best/quickest way to use some data generated by CUDA
(via pycuda) as an OpenGL texture?
I've been browsing around for a while but I'm not yet quite sure what
the most efficient way is. I've seen examples using
pycuda.gl.RegisterBuffer in combination with glTexSubImage2D (i.e the
pycuda SobelFilter example) but I'm wondering if there's a better way
to do it using pycuda.gl.RegisteredImage?
Just a quick sequence of the API calls I need to use would be enough,
and I can figure out the details myself.
Basically you need to create OpenGL object, then get handler (pointer)
to it and pass it to PyCUDA.
I was using something along the lines:
gl_object = create texture
cuda_buffer = pycuda.gl.RegisteredBuffer(long(gl_object),
And then in drawing:
cuda_object = cuda_buffer.map()
glDrawArrays()... and so on
Important thing is to synchronize between CUDA and OpenGL,
and never call CUDA kernels on currently drawn object.
Hope that helps.
Tomasz Rybak, Debian Maintainer <tomasz.rybak(a)post.pl>
GPG: A481 824E 7DD3 9C0E C40A 488E C654 FB33 2AD5 9860