From e21a485dbc3d0540652c4527b30d059e7924eccd Mon Sep 17 00:00:00 2001 From: jsjtxietian Date: Thu, 7 Sep 2023 12:54:06 +0800 Subject: [PATCH] Fix clear color's alpha value will affects 2D editor in Compatibility mode When the rt's transparency is false, force the alpha of the clear color to one --- drivers/gles3/rasterizer_canvas_gles3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 01568763687..9818674de62 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -2115,7 +2115,7 @@ void RasterizerCanvasGLES3::canvas_begin(RID p_to_render_target, bool p_to_backb if (render_target && render_target->clear_requested) { const Color &col = render_target->clear_color; - glClearColor(col.r, col.g, col.b, col.a); + glClearColor(col.r, col.g, col.b, render_target->is_transparent ? col.a : 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); render_target->clear_requested = false;