diff options
author | clayjohn <claynjohn@gmail.com> | 2023-02-14 10:30:02 -0800 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2023-02-14 10:30:02 -0800 |
commit | 081b31d20091806eb32d13561df997fd734ca7b3 (patch) | |
tree | ebf9fc695d8ca0457b1b3cbbc2f3a9356c385bff /drivers/gles3 | |
parent | 8c7b98d4526c6ba66d7f1636abb71ccbe54727c6 (diff) |
Clear Window before blitting Viewport in gl_compatibility renderer
Diffstat (limited to 'drivers/gles3')
-rw-r--r-- | drivers/gles3/rasterizer_gles3.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 2e3e6263ed..600aa908cc 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -306,6 +306,15 @@ void RasterizerGLES3::_blit_render_target_to_screen(RID p_render_target, Display glReadBuffer(GL_COLOR_ATTACHMENT0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, GLES3::TextureStorage::system_fbo); + + if (p_screen_rect.position != Vector2()) { + // Viewport doesn't cover entire window so clear window to black before blitting. + Size2i win_size = DisplayServer::get_singleton()->window_get_size(); + glViewport(0, 0, win_size.width, win_size.height); + glClearColor(0.0, 0.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + } + Vector2i screen_rect_end = p_screen_rect.get_end(); glBlitFramebuffer(0, 0, rt->size.x, rt->size.y, p_screen_rect.position.x, flip_y ? screen_rect_end.y : p_screen_rect.position.y, screen_rect_end.x, flip_y ? p_screen_rect.position.y : screen_rect_end.y, |