How To Write From CUDA Kernel To OpenGL Texture Handle

So I’m generating an image with CUDA. Currently, I have an array of interleaved RGBA uint8 pixels, the kernel writes to this array, and then the array is used to update an SFML Texture. However the update step is currently incredibly slow, taking a total of 32ms. Is it possible to write directly from the kernel into the texture? SFML allows us to get the native handle of the texture, which is just a GLuint. How can I write to this directly in the kernel?

cudaGraphicsGLRegisterImage, cudaCreateSurfaceObject cudaGraphicsMapResources, write to the surface in a kernel, cudaGraphicsUnmapResources, draw in GL.