diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp index 373df8d8de7..a65347a5b1b 100644 --- a/drivers/gles3/storage/texture_storage.cpp +++ b/drivers/gles3/storage/texture_storage.cpp @@ -2312,9 +2312,11 @@ void TextureStorage::_clear_render_target(RenderTarget *rt) { if (rt->backbuffer_fbo != 0) { glDeleteFramebuffers(1, &rt->backbuffer_fbo); + rt->backbuffer_fbo = 0; + } + if (rt->backbuffer != 0) { GLES3::Utilities::get_singleton()->texture_free_data(rt->backbuffer); rt->backbuffer = 0; - rt->backbuffer_fbo = 0; } if (rt->backbuffer_depth != 0) { GLES3::Utilities::get_singleton()->texture_free_data(rt->backbuffer_depth);