From 8ffc5b99b5f0a9b9bf6ec9f237ac2b168e5dfaa3 Mon Sep 17 00:00:00 2001 From: "A.Olokhtonov" Date: Sun, 24 Nov 2024 23:11:19 +0300 Subject: [PATCH] Fix z range which sometimes caused the last stroke to have Z equal to exactly 1 and thus not draw. Fix wrong size of texture upload --- client/webgl_draw.js | 2 +- client/webgl_shaders.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/webgl_draw.js b/client/webgl_draw.js index b10fba8..783df61 100644 --- a/client/webgl_draw.js +++ b/client/webgl_draw.js @@ -61,7 +61,7 @@ function upload_square_rgba16ui_texture(gl, serializer, texture_size) { // Upload last row if (last_row > 0) { const last_row_upload = last_row * bpp; - gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, rows_uploaded, last_row, 1, gl.RGBA_INTEGER, gl.UNSIGNED_SHORT, new Uint16Array(serializer.buffer, whole_upload, last_row_upload * 4)); + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, rows_uploaded, last_row, 1, gl.RGBA_INTEGER, gl.UNSIGNED_SHORT, new Uint16Array(serializer.buffer, whole_upload, last_row_upload)); } serializer.gpu_upload_from = serializer.offset; diff --git a/client/webgl_shaders.js b/client/webgl_shaders.js index 123d768..0ec0773 100644 --- a/client/webgl_shaders.js +++ b/client/webgl_shaders.js @@ -68,7 +68,7 @@ const sdf_vs_src = `#version 300 es screen02 += vec2(100.0); // shift offscreen } - gl_Position = vec4(screen02 - 1.0, (float(stroke_index + 1) / float(u_stroke_count)) * 2.0 - 1.0, 1.0); + gl_Position = vec4(screen02 - 1.0, (float(stroke_index + 1) / float(u_stroke_count + 1)) * 2.0 - 1.0, 1.0); } `;