From df4914216e90cad11f1782c29907444e5dc1cc71 Mon Sep 17 00:00:00 2001 From: Devin Elrose Date: Fri, 24 Nov 2023 22:02:46 -0800 Subject: [PATCH] finally, a way to keep the dang colors Why was this so hard to find??? --- libs/webgl/src/engine/BaseDrawingEngine.ts | 2 +- libs/webgl/src/engine/DrawingEngine.ts | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/libs/webgl/src/engine/BaseDrawingEngine.ts b/libs/webgl/src/engine/BaseDrawingEngine.ts index 2ee31dd..c07aa81 100644 --- a/libs/webgl/src/engine/BaseDrawingEngine.ts +++ b/libs/webgl/src/engine/BaseDrawingEngine.ts @@ -9,7 +9,7 @@ export abstract class BaseDrawingEngine< private programs: Programs constructor(canvas: HTMLCanvasElement, programs: (gl: WebGLRenderingContext) => Programs) { - const gl = canvas.getContext("webgl") + const gl = canvas.getContext("webgl", { preserveDrawingBuffer: true }) if (!gl) { throw new Error("WebGL not supported") } diff --git a/libs/webgl/src/engine/DrawingEngine.ts b/libs/webgl/src/engine/DrawingEngine.ts index 95d9a5c..c65e85a 100644 --- a/libs/webgl/src/engine/DrawingEngine.ts +++ b/libs/webgl/src/engine/DrawingEngine.ts @@ -29,9 +29,6 @@ export class DrawingEngine extends BaseDrawingEngine { } public updateDrawing() { - for (const { path, color } of this.context.pathHistory) { - this.drawLine(path, { drawType: DrawType.STATIC_DRAW, color }) - } if (this.context.currentPath.points.length > 0) { this.drawLine(this.context.currentPath.points, { drawType: DrawType.DYNAMIC_DRAW }) }