diff options
author | ChibiDenDen <pdaniq@gmail.com> | 2023-03-15 18:55:10 +0200 |
---|---|---|
committer | RĂ©mi Verschelde <rverschelde@gmail.com> | 2023-05-12 12:31:22 +0200 |
commit | bb785cfcc0f01cd8e41a25a5bfb461476c790a3d (patch) | |
tree | 9881aa67b8bf403a6d0360b06d298e5e41f133bd /drivers/gles3 | |
parent | cf0bd389cc7294c7e8bc6dbc57a88880cfd8372e (diff) |
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 5956aa1a6a7df8b098a12a585f5541042ee1cc6e)
Diffstat (limited to 'drivers/gles3')
-rw-r--r-- | drivers/gles3/rasterizer_gles3.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 7cbce428cb..4e5e103884 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -300,12 +300,13 @@ void RasterizerGLES3::_blit_render_target_to_screen(RID p_render_target, Display } GLuint read_fbo = 0; + glGenFramebuffers(1, &read_fbo); + glBindFramebuffer(GL_READ_FRAMEBUFFER, read_fbo); + if (rt->view_count > 1) { - glGenFramebuffers(1, &read_fbo); - glBindFramebuffer(GL_READ_FRAMEBUFFER, read_fbo); 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); |