Fix gles3 rendering on android studio emulator

Use a temporary framebuffer for screen copy from rendertarget to screen.

This solves GLES3 rendering in android studio emulator (before this change there is just a black screen)

Based on discussion in:
https://github.com/godotengine/godot/issues/74828

(cherry picked from commit 5956aa1a6a)
This commit is contained in:
ChibiDenDen 2023-03-15 18:55:10 +02:00 committed by Rémi Verschelde
parent cf0bd389cc
commit bb785cfcc0
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 4 additions and 3 deletions

View File

@ -300,12 +300,13 @@ void RasterizerGLES3::_blit_render_target_to_screen(RID p_render_target, Display
}
GLuint read_fbo = 0;
if (rt->view_count > 1) {
glGenFramebuffers(1, &read_fbo);
glBindFramebuffer(GL_READ_FRAMEBUFFER, read_fbo);
if (rt->view_count > 1) {
glFramebufferTextureLayer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, rt->color, 0, p_layer);
} else {
glBindFramebuffer(GL_READ_FRAMEBUFFER, rt->fbo);
glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0);
}
glReadBuffer(GL_COLOR_ATTACHMENT0);