summaryrefslogtreecommitdiff
path: root/drivers/gles2
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-01-27 15:47:17 -0300
committerJuan Linietsky <reduzio@gmail.com>2019-01-27 15:47:17 -0300
commit953cd03ea6ee9fd6d0d3fde9658777cc4020d0a7 (patch)
tree9b3f84f26d0f1a9a80805815c5708a17555da794 /drivers/gles2
parent70d6d0fa69c36cd9a673bc313c711814dc79a4f4 (diff)
Use transparent framebuffer only when set to transparent, closes #21827
Diffstat (limited to 'drivers/gles2')
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp
index 6f686690bf..64e4dbdab4 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.cpp
+++ b/drivers/gles2/rasterizer_canvas_gles2.cpp
@@ -112,9 +112,11 @@ void RasterizerCanvasGLES2::_set_uniforms() {
void RasterizerCanvasGLES2::canvas_begin() {
state.canvas_shader.bind();
+ bool transparent = false;
if (storage->frame.current_rt) {
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo);
glColorMask(1, 1, 1, 1);
+ transparent = storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT];
}
if (storage->frame.clear_request) {
@@ -122,11 +124,13 @@ void RasterizerCanvasGLES2::canvas_begin() {
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);
+ 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);
+
/*
if (storage->frame.current_rt) {
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo);
@@ -182,6 +186,7 @@ void RasterizerCanvasGLES2::canvas_end() {
state.using_texture_rect = false;
state.using_skeleton = false;
state.using_ninepatch = false;
+ glColorMask(1, 1, 1, 1);
}
RasterizerStorageGLES2::Texture *RasterizerCanvasGLES2::_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map) {