Skip to content

Commit f94e7b4

Browse files
committed
Set dimensions before resizing. Validate gl objects before deleting them.
1 parent d6496c8 commit f94e7b4

1 file changed

Lines changed: 24 additions & 12 deletions

File tree

src/renderer/webgl/WebGLRenderer.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -868,8 +868,19 @@ var WebGLRenderer = new Class({
868868
var game = this.game;
869869
var pipelineManager = this.pipelines;
870870

871+
var baseSize = game.scale.baseSize;
872+
873+
this.width = baseSize.width;
874+
this.height = baseSize.height;
875+
876+
// Set-up pipelines
877+
878+
// First, default ones
879+
pipelineManager.boot();
880+
871881
var pipelines = game.config.pipeline;
872882

883+
// Then, custom ones
873884
if (pipelines)
874885
{
875886
for (var pipelineName in pipelines)
@@ -880,15 +891,11 @@ var WebGLRenderer = new Class({
880891
}
881892
}
882893

883-
pipelineManager.boot();
884-
885-
var multi = pipelineManager.get(PIPELINE_CONST.MULTI_PIPELINE);
894+
// Set-up default textures, fbo and scissor
886895

887896
this.blankTexture = game.textures.getFrame('__DEFAULT');
888897
this.whiteTexture = game.textures.getFrame('__WHITE');
889898

890-
multi.currentFrame = this.whiteTexture;
891-
892899
var gl = this.gl;
893900

894901
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
@@ -897,11 +904,7 @@ var WebGLRenderer = new Class({
897904

898905
game.scale.on(ScaleEvents.RESIZE, this.onResize, this);
899906

900-
var baseSize = game.scale.baseSize;
901-
902907
this.resize(baseSize.width, baseSize.height);
903-
904-
// pipelineManager.setMulti();
905908
},
906909

907910
/**
@@ -1997,7 +2000,10 @@ var WebGLRenderer = new Class({
19972000
*/
19982001
deleteTexture: function (texture, reset)
19992002
{
2000-
this.gl.deleteTexture(texture);
2003+
if (texture)
2004+
{
2005+
this.gl.deleteTexture(texture);
2006+
}
20012007

20022008
if (reset)
20032009
{
@@ -2019,7 +2025,10 @@ var WebGLRenderer = new Class({
20192025
*/
20202026
deleteFramebuffer: function (framebuffer)
20212027
{
2022-
this.gl.deleteFramebuffer(framebuffer);
2028+
if (framebuffer)
2029+
{
2030+
this.gl.deleteFramebuffer(framebuffer);
2031+
}
20232032

20242033
return this;
20252034
},
@@ -2036,7 +2045,10 @@ var WebGLRenderer = new Class({
20362045
*/
20372046
deleteProgram: function (program)
20382047
{
2039-
this.gl.deleteProgram(program);
2048+
if (program)
2049+
{
2050+
this.gl.deleteProgram(program);
2051+
}
20402052

20412053
return this;
20422054
},

0 commit comments

Comments
 (0)