Fixed issue with FBO leaving no bound texture on unit zero.

This commit is contained in:
Richard Davey 2016-11-03 21:50:14 +00:00
parent 181e08a1f9
commit 16e687cb2a
2 changed files with 9 additions and 5 deletions

View file

@ -115,9 +115,11 @@ Phaser.Renderer.WebGL.QuadFBO.prototype = {
this.createShader();
this.emptyTexture = this.renderer.createEmptyTexture(1, 1, 0, 0);
// Reset back to defaults
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
// gl.bindRenderbuffer(gl.RENDERBUFFER, null);
// gl.bindFramebuffer(gl.FRAMEBUFFER, null);
},
// This whole function ought to be split out into the Shader Manager
@ -295,8 +297,10 @@ Phaser.Renderer.WebGL.QuadFBO.prototype = {
this.renderer.drawCount++;
// Unbind the fbo texture - if we forget this we corrupt the main context texture!
gl.bindTexture(gl.TEXTURE_2D, null);
// Unbind the fbo texture and replace it with an empty texture.
// If we forget this we corrupt the main context texture!
// or get `RENDER WARNING: there is no texture bound to the unit 0` spam in the console
gl.bindTexture(gl.TEXTURE_2D, this.emptyTexture);
},
destroy: function ()

View file

@ -322,7 +322,7 @@ Phaser.Renderer.WebGL.prototype = {
if (Array.isArray(textureArray))
{
// index 0 is reserved!
// index 0 is reserved?
var index = 0;
for (var i = 0; i < textureArray.length; i++)