I made a framebuffer and connected it to two color attachments.
GLfloat clearColor[] = { 0.5f ,0.5f ,0.5f ,1.0f };
glClearBufferfv(GL_COLOR, 0, clearColor);
This confirmed that the texture of color attachment 0 was cleared.
I checked the open reference.
If buffer is GL_COLOR, a particular draw buffer GL_DRAW_BUFFERi is specified by passing i as drawbuffer, and value points to a four-element vector specifying the R, G, B and A color to clear that draw buffer to. If the value of GL_DRAW_BUFFERi is GL_NONE, the command has no effect.
The opengl reference reads as above.
GLfloat clearColor[] = { 0.5f ,0.5f ,0.5f ,1.0f };
glClearBufferfv(GL_COLOR, GL_DRAW_BUFFER0, clearColor);
I tried changing the source code as above, but it had no effect, and the background was black without being cleared.
I wonder what GL_DRAW_BUFFER0 is described in the reference.