Array Remove and unbind before deleting the framebuffer

This commit is contained in:
Richard Davey 2023-10-12 15:22:23 +01:00
parent 2d364f08c4
commit 1935119141

View file

@ -2291,10 +2291,20 @@ var WebGLRenderer = new Class({
*/
deleteFramebuffer: function (framebuffer)
{
if (framebuffer)
if (!framebuffer)
{
return this;
}
var gl = this.gl;
if (this.currentFramebuffer === framebuffer)
{
this.currentFramebuffer = null;
}
ArrayRemove(this.fboStack, framebuffer);
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
// Check for a color attachment and remove it
@ -2320,14 +2330,6 @@ var WebGLRenderer = new Class({
gl.deleteFramebuffer(framebuffer);
ArrayRemove(this.fboStack, framebuffer);
if (this.currentFramebuffer === framebuffer)
{
this.currentFramebuffer = null;
}
}
return this;
},