Fixed issue when destroying WebGLRenderer

This commit is contained in:
Felipe Alfonso 2018-04-16 15:16:23 -03:00
parent 1507dcf448
commit 5cc2ebd6be

View file

@ -400,7 +400,7 @@ var WebGLRenderer = new Class({
var clearColor = config.backgroundColor;
var gl = canvas.getContext('webgl', config.contextCreation) || canvas.getContext('experimental-webgl', config.contextCreation);
if (!gl)
if (!gl || gl.isContextLost())
{
this.contextLost = true;
throw new Error('This browser does not support WebGL. Try using the Canvas pipeline.');
@ -1890,11 +1890,6 @@ var WebGLRenderer = new Class({
delete this.nativeTextures[index];
}
if (this.hasExtension('WEBGL_lose_context'))
{
this.getExtension('WEBGL_lose_context').loseContext();
}
delete this.gl;
delete this.game;