It might be better to ask similar questions on the PyCUDA mailing list, in CC.
Also - sorry it took so long to get to your email On Tue, 2016-06-07 at 22:11 +1000, Lars Andersson wrote: > Hi Tomasz, > > 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: Preparation: gl_object = create texture cuda_buffer = pycuda.gl.RegisteredBuffer(long(gl_object), GL_TEXTURE_2D) And then in drawing: cuda_object = cuda_buffer.map() cuda_function.prepared_call((16, 16), cuda_object.device_ptr_and_size()[0]) pycuda.driver.Context.synchronize() cuda_object.unmap() 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. Best regards. -- Tomasz Rybak, Debian Maintainer <tomasz.ry...@post.pl> GPG: A481 824E 7DD3 9C0E C40A 488E C654 FB33 2AD5 9860 http://member.acm.org/~tomaszrybak _______________________________________________ PyCUDA mailing list PyCUDA@tiker.net https://lists.tiker.net/listinfo/pycuda