You can attach an image in a texture to a framebuffer, so that you can render directly to that texture.
glGenFramebuffers (1, &framebuffer);
glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D,
texture,
0);
Note: you can't read and write from same texture in same render task, because it call undefined behaviour. But you can use: glTextureBarrier()
between render calls for this.