The problem of using 2 framebuffers

I have 2 framebuffers and they work well individually, but if I try to use them sequentially, draws black screen.
framebuffer creation function:

int nomObr = postObrabotchiki.PolychitRazmer();
postObrabotchiki += PostObrabotchik();

postObrabotchiki[nomObr].shader = ZagryzchikSohranshik::ZagryzitISozdatShaderProgramy(pytVersh, pytFrag, pytGeom);

glUseProgram(postObrabotchiki[nomObr].shader);
glUniform1i(glGetUniformLocation(postObrabotchiki[nomObr].shader, "ekran"), 0);

glGenFramebuffers(1, &postObrabotchiki[nomObr].id);
glBindFramebuffer(GL_FRAMEBUFFER, postObrabotchiki[nomObr].id);

int shirina, visota;
glfwGetFramebufferSize(Igra::PolychitOkno(), &shirina, &visota);

glGenTextures(1, &postObrabotchiki[nomObr].kartinkaEkrana);
glBindTexture(GL_TEXTURE_2D, postObrabotchiki[nomObr].kartinkaEkrana);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, shirina, visota, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, postObrabotchiki[nomObr].kartinkaEkrana, 0);

unsigned int RBO;
glGenRenderbuffers(1, &RBO);
glBindRenderbuffer(GL_RENDERBUFFER, RBO);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, shirina, visota);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, RBO);

auto fboSost = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (fboSost != GL_FRAMEBUFFER_COMPLETE)
	return;

glBindFramebuffer(GL_FRAMEBUFFER, 0);

The framebuffer usage function:

glBindFramebuffer(GL_FRAMEBUFFER, postObrabotchiki[0].id);

*draw model*

glBindFramebuffer(GL_FRAMEBUFFER, postObrabotchiki[1].id);
glUseProgram(postObrabotchiki[0].shader);
glBindVertexArray(ekranVAO);
glBindTexture(GL_TEXTURE_2D, postObrabotchiki[0].kartinkaEkrana);
glDrawArrays(GL_TRIANGLES, 0, 6);

glBindFramebuffer(GL_FRAMEBUFFER, 0);
glUseProgram(postObrabotchiki[1].shader);
glBindVertexArray(ekranVAO);
glBindTexture(GL_TEXTURE_2D, postObrabotchiki[1].kartinkaEkrana);
glDrawArrays(GL_TRIANGLES, 0, 6);

How to use more than 1 framebuffer correctly?

Considering the number of vertices and the default framebuffer being bound… I assumed you are atleast using the result of the first FBO as an resource to be draw in a fullscreen quad into the secound FBO, then using the result of the second FBO to draw to default framebuffer. Possible troubles common in this fashion of operation chain includes erroneous texture/sampler configurations or improper viewport handling. You may dump the result drawing target’s buffer to a TGA file try to locate where you are getting a black screen.

Рello, how would it be correct to use a framebuffer texture?
The problem occurs when I turn on the second framebuffer after the first one, but if I use only one framebuffer, then everything works fine (the order in which framebuffers are turned on does not affect the result)

Your code looks oversimplified (and var names doesn’t help too) to give better insights.
Are you sure to have get uniform locations for your shader resources and set the correct binding point? Ex.:

// setting up the pipeline layout (if you are not using hardcoded binding points in shader)
GLuint texBindingSlot = 0; // GL_TEXTURE0
GLuint texBindingLoc = glGetUniformLocation(progHandle, "tex");
assert(texBindingLoc != (GLuint)-1); // if not found is will be an invalid index
glUniform1i(texBindingLoc, texBindingSlot); // binding the shader interface to the texture binding point GL_TEXTURE0.

// binding resources to numbered slots in context to be used by pipeline
glActiveTexture(GL_TEXTURE0 + texBindingSlot); 
glBindTexture(GL_TEXTURE_2D, texHandle);

May be your texture is not correctly bound in shader so not raster data is being transfered. It is a common issue for black screens. GL defaults mostly to zero. This fact makes non-explicit/unhandled/unassigned states to work but subsequent operations will need proper handling.

You should user RenderDoc to capture and investigate what is going on pipeline. Specially to investigate the bound resources and state of color output to framebuffer.