mirror of
https://github.com/godotengine/godot.git
synced 2025-04-01 00:41:35 +08:00
Use transparent framebuffer only when set to transparent, closes #21827
This commit is contained in:
parent
70d6d0fa69
commit
953cd03ea6
@ -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) {
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user