Skip to content

Commit 1742ec0

Browse files
committed
RenderPass Update
1 parent 18e3b93 commit 1742ec0

2 files changed

Lines changed: 22 additions & 7 deletions

File tree

v3/src/gameobjects/renderpass/RenderPass.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ var RenderPass = new Class({
6060
var gl = this.renderer.gl;
6161
if (gl)
6262
{
63-
gl.bindFramebuffer(gl.FRAMBUFFER, this.passRenderTarget.framebufferObject);
63+
gl.bindFramebuffer(gl.FRAMEBUFFER, this.passRenderTarget.framebufferObject);
6464
gl.clearColor(r, g, b, a);
6565
gl.clear(gl.COLOR_BUFFER_BIT);
66-
gl.bindFramebuffer(gl.FRAMBUFFER, null);
66+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
6767
}
6868
},
6969

@@ -72,25 +72,25 @@ var RenderPass = new Class({
7272
var gl = this.renderer.gl;
7373
if (gl)
7474
{
75-
gl.bindFramebuffer(gl.FRAMBUFFER, this.passRenderTarget.framebufferObject);
75+
gl.bindFramebuffer(gl.FRAMEBUFFER, this.passRenderTarget.framebufferObject);
7676
gl.clearDepth(depth);
7777
gl.clearStencil(stencil);
7878
gl.clear(gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
79-
gl.bindFramebuffer(gl.FRAMBUFFER, null);
79+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
8080
}
8181
},
8282

83-
clearAllBuffers: function (depth, stencil)
83+
clearAllBuffers: function (r, g, b, a, depth, stencil)
8484
{
8585
var gl = this.renderer.gl;
8686
if (gl)
8787
{
88-
gl.bindFramebuffer(gl.FRAMBUFFER, this.passRenderTarget.framebufferObject);
88+
gl.bindFramebuffer(gl.FRAMEBUFFER, this.passRenderTarget.framebufferObject);
8989
gl.clearColor(r, g, b, a);
9090
gl.clearDepth(depth);
9191
gl.clearStencil(stencil);
9292
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
93-
gl.bindFramebuffer(gl.FRAMBUFFER, null);
93+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
9494
}
9595
},
9696

@@ -105,6 +105,20 @@ var RenderPass = new Class({
105105
}
106106
},
107107

108+
setRenderTextureAt: function (renderTexture, samplerName, unit)
109+
{
110+
var gl = this.renderer.gl;
111+
if (gl)
112+
{
113+
/* Texture 1 is reserved for Phaser's Main Renderer */
114+
unit = unit > 0 ? unit : 1;
115+
this.setInt(samplerName, unit);
116+
gl.activeTexture(gl.TEXTURE0 + unit);
117+
gl.bindTexture(gl.TEXTURE_2D, renderTexture.texture);
118+
gl.activeTexture(gl.TEXTURE0);
119+
}
120+
},
121+
108122
getUniformLocation: function (uniformName)
109123
{
110124
var passShader = this.passShader;

v3/src/renderer/webgl/WebGLRenderer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ WebGLRenderer.prototype = {
112112
this.spriteBatch = this.addRenderer(new SpriteBatch(this.game, gl, this));
113113
this.shapeBatch = this.addRenderer(new ShapeBatch(this.game, gl, this));
114114
this.effectRenderer = this.addRenderer(new EffectRenderer(this.game, gl, this));
115+
this.setBlendMode(0);
115116
},
116117

117118
createTexture: function (source)

0 commit comments

Comments
 (0)