After much trial and error, I've finally discovered a solution.
First, I start by performing the following steps:
texture = new THREE.Texture();
texture.__webglTexture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture.__webglTexture );
texture.__webglInit = false;
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, size, size, 0, gl.RGBA, gl.FLOAT, null);
gl.bindTexture( gl.TEXTURE_2D, null )
Next, I can easily bind the textures to the framebuffer like so:
gl.framebufferTexture2D(gl.FRAMEBUFFER, COLOR_ATTACHMENT0_WEBGL, gl.TEXTURE_2D, texture1.__webglTexture, 0);
gl.framebufferTexture2D(gl.FRAMEBUFFER, COLOR_ATTACHMENT1_WEBGL, gl.TEXTURE_2D, texture2.__webglTexture , 0);
// Any other texture that is needed
Subsequently, I proceed with these actions:
gl.bindFramebuffer(gl.FRAMEBUFFER,FBO[0]);
renderer.setSize(size,size);
renderer.render(scene,camera);
shaderSwap();
renderer.setSize(window.innerWidth,window.innerHeight)
gl.bindFramebuffer(gl.FRAMEBUFFER,null)
For the second pass, all that's required is to have the textures as uniforms.