mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 12:43:26 +00:00
The WebGLRenderer.deleteFramebuffer
method has been updated so it now tests for the exitennce of a COLOR and DEPTH_STENCIL attachments, and if found, removes the bindings and deletes the stencil buffer. The code that previously deelted the RENDERERBUFFER_BINDING
has also been removed to avoid side-effects.
This commit is contained in:
parent
45fb3e6442
commit
e8e57b6b0c
1 changed files with 15 additions and 3 deletions
|
@ -2297,11 +2297,23 @@ var WebGLRenderer = new Class({
|
|||
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
|
||||
|
||||
var renderBuffer = gl.getParameter(gl.RENDERBUFFER_BINDING);
|
||||
// Check for a color attachment and remove it
|
||||
var colorAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (renderBuffer)
|
||||
if (colorAttachment !== null)
|
||||
{
|
||||
gl.deleteRenderbuffer(renderBuffer);
|
||||
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0);
|
||||
|
||||
// TODO: Check if this texture is used elsewhere. If not, delete it:
|
||||
// gl.deleteTexture(colorAttachment);
|
||||
}
|
||||
|
||||
// Check for a depth-stencil attachment and delete it
|
||||
var depthStencilAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (depthStencilAttachment !== null)
|
||||
{
|
||||
gl.deleteRenderbuffer(depthStencilAttachment);
|
||||
}
|
||||
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||
|
|
Loading…
Reference in a new issue