From e570af5bc8e44b5c77070048a3f5dd93601627fc Mon Sep 17 00:00:00 2001 From: Rezmason Date: Fri, 3 Sep 2021 22:59:35 -0700 Subject: [PATCH] Glyphs now blend additively, and the renderer's output buffer is cleared before it's drawn to. --- js/renderer.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/js/renderer.js b/js/renderer.js index 3ba6232..7015d8e 100644 --- a/js/renderer.js +++ b/js/renderer.js @@ -277,6 +277,15 @@ export default (regl, config) => { // We render the code into an FBO using MSDFs: https://github.com/Chlumsky/msdfgen const render = regl({ + blend: { + enable: true, + func: { + srcRGB: "src alpha", + srcAlpha: 1, + dstRGB: "dst alpha", + dstAlpha: 1 + } + }, vert: ` precision lowp float; attribute vec2 aPosition, aCorner; @@ -394,6 +403,11 @@ export default (regl, config) => { }, resources => { update(); + regl.clear({ + depth: 1, + color: [0, 0, 0, 1], + framebuffer: output + }); render(resources); }, null,