Is it possible to save CUDA results in an open OpenGL texture?
Yes, CUDA has API functions to interact with OpenGL
Use cudaGLRegisterBufferObject(GLuint bufObj)
to register with CUDA and then use cudaGLMapBufferObject( void ** devPtr, GLuint bufObj)
to get the device memory pointer for buffer management in your CUDA kernel.
Then undo cudaGLUnmapBufferObject(GLuint bufObj)
and then display.
For a complete description, see the CUDA Programming Guide that you download in the CUDA Toolkit.
a source to share
Grade. You cannot write textures from the kernel directly, but you can make a copy of the results from your kernel to a cudaArray texture without copying it back to system memory. Look cudaGraphicsGLRegisterImage()
, cudaGraphicsMapResources()
and cudaGraphicsSubResourceGetMappedArray()
.
a source to share