Q:

THREEJS: Clear RT and default FBO with different colors

I am rendering a scene once into WebGLRenderTarget and then into default Frame buffer like this:
  //want the BG of RT to be green
  renderer.setClearColor(0x00ff00,1);
  renderer.clearTarget(renderTargetTex, true,true);
  renderer.render(this._scene, cam,renderTargetTex, true);

  //now render same scene into default FBO:
  //set red BG
  renderer.setClearColor(0xff0000,1);
  renderer.clear();
  renderer.render(this._scene,cam);

The result is always black background background.  But if I don't call
  renderer.clearTarget(renderTargetTex, true,true);
  renderer.render(this._scene, cam,renderTargetTex, true);

The renderer autoClear is set to false
Then I am getting the back buffer cleared to red.  How do I  clear each RT to its color?  I am using THREE.js version 93dev

A:

renderer.clear() will clear the current render target. 
If you want to clear a target different from the current one, you have to set the desired target first. 
You can use this pattern, instead: 
renderer.setRenderTarget( renderTarget );
renderer.setClearColor( color1, alpha1 );
renderer.clear();
renderer.render( scene, camera, renderTarget, true );

renderer.setRenderTarget( null );
renderer.setClearColor( color2, alpha2 );
renderer.clear();
renderer.render( scene, camera );

three.js r.97

