Skip to content

Commit 9f15b86

Browse files
committed
penStamp directly to PenSkin's framebuffer
1 parent cc5fea8 commit 9f15b86

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

src/RenderWebGL.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,23 +1451,14 @@ class RenderWebGL extends EventEmitter {
14511451
const skin = /** @type {PenSkin} */ this._allSkins[penSkinID];
14521452

14531453
const gl = this._gl;
1454-
twgl.bindFramebufferInfo(gl, this._queryBufferInfo);
1454+
twgl.bindFramebufferInfo(gl, skin._framebuffer);
14551455

14561456
// Limit size of viewport to the bounds around the stamp Drawable and create the projection matrix for the draw.
1457-
gl.viewport(0, 0, bounds.width, bounds.height);
1457+
gl.viewport(240 + bounds.left, 180 - bounds.top, bounds.width, bounds.height);
14581458
const projection = twgl.m4.ortho(bounds.left, bounds.right, bounds.top, bounds.bottom, -1, 1);
14591459

1460-
gl.clearColor(0, 0, 0, 0);
1461-
gl.clear(gl.COLOR_BUFFER_BIT);
1462-
1463-
try {
1464-
gl.disable(gl.BLEND);
1465-
this._drawThese([stampID], ShaderManager.DRAW_MODE.stamp, projection, {ignoreVisibility: true});
1466-
} finally {
1467-
gl.enable(gl.BLEND);
1468-
}
1469-
1470-
skin._drawToBuffer(this._queryBufferInfo.attachments[0], bounds.left, bounds.top);
1460+
// Draw the stamped sprite onto the PenSkin's framebuffer.
1461+
this._drawThese([stampID], ShaderManager.DRAW_MODE.stamp, projection, {ignoreVisibility: true});
14711462
}
14721463

14731464
/* ******

0 commit comments

Comments
 (0)