You can use the function

void glBindFragDataLocation( GLuint program, GLuint colorNumber, const char *name );

to define which fragment shader out variable is written into which color buffer....