Copying pixels from FBO to another texture.

Oh great OpenGL gurus:

I’m implementing a simple paint procedure in a film graphics app for retouching dirt out. I want to create a texture that will hold the current results of the painting procedure.

The problem is that the texture is both the source image and the destination render texture. The only way I can think to do this is to render each brush stroke to an FBO, and then copy the pixel data to the source texture.

My question is: What is the easiest way to copy an FBO texture to another identical texture?

How are you rendering your strokes? If you are using shaders you probably could render your input texture into a fullscreen quad and apply the stroke in the shader. Then simply swap the destination texture (bound to the fbo color attachment) with the input texture and paint the next stroke… (no complete copy needed)

As a simpler, but maybe not so efficient answer you could always use glCopyTexImage2D …?