What happens when glDrawArrays in the memory, and how to read multiple attached images to store in the disk?

I have multiple fragment shader output variables, and I want to use them as attached-images in the framebuffer, so that I could read them out and store as images in the disk.

But I am not sure how to do it with or without off-screen rendering.

What happens when I call glDrawArray? when should I use glReadBuffer and glReadPixel? Assume I have 3 outputs variables, that is

layout (location = 0) out vec3 a;
layout (location = 1) out float b;
layout (location = 2) out vec4 c; 

Assume I create the 3 draw buffers:

glDrawBuffers(3, imagebuffers);

Could anyone give me a code, how should I order these commands?

Before the draw call, you need to call glBindFramebuffer, glFramebufferTexture* or glFramebufferRenderbuffer for each attachment, and glDrawBuffers. After the draw call you can use glReadBuffer and glReadPixels to read data from a specific buffer.