1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

Use transparent framebuffer only when set to transparent, closes #21827

This commit is contained in:
Juan Linietsky
2019-01-27 15:47:17 -03:00
parent 70d6d0fa69
commit 953cd03ea6
2 changed files with 13 additions and 2 deletions

View File

@@ -146,10 +146,15 @@ void RasterizerCanvasGLES3::canvas_begin() {
if (storage->frame.current_rt && storage->frame.clear_request) {
// a clear request may be pending, so do it
bool transparent = storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT];
glClearColor(storage->frame.clear_request_color.r, storage->frame.clear_request_color.g, storage->frame.clear_request_color.b, storage->frame.clear_request_color.a);
glClearColor(storage->frame.clear_request_color.r,
storage->frame.clear_request_color.g,
storage->frame.clear_request_color.b,
transparent ? storage->frame.clear_request_color.a : 1.0);
glClear(GL_COLOR_BUFFER_BIT);
storage->frame.clear_request = false;
glColorMask(1, 1, 1, transparent ? 1 : 0);
}
reset_canvas();
@@ -193,6 +198,7 @@ void RasterizerCanvasGLES3::canvas_end() {
glBindVertexArray(0);
glBindBufferBase(GL_UNIFORM_BUFFER, 0, 0);
glColorMask(1, 1, 1, 1);
state.using_texture_rect = false;
state.using_ninepatch = false;