Can CUDA be used to generate OpenGL textures? I know it can be done by reading the CUDA results back into system memory, and then loading that into a texture… But I’d like to find a way to save this copy… Can CUDA be used to generate textures?
Share
Yes, CUDA has API functions to allow for OpenGL Interoperability
Use
cudaGLRegisterBufferObject(GLuint bufObj)to register to CUDA and then usecudaGLMapBufferObject( void ** devPtr, GLuint bufObj)to get the device memory pointer to manipulate the buffer in your CUDA kernal.Once done, you unmap
cudaGLUnmapBufferObject(GLuint bufObj)and then display.Full explanation is in the CUDA Programming Guide that you download in the CUDA Toolkit.