From 8511cd7a4828ebbed9af28411ceba748e00b9b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20S=C3=A1nchez=20Ortega?= Date: Thu, 22 Dec 2022 03:55:51 +0100 Subject: [PATCH] Allow DataView in .bufferData() & .bufferSubData() calls --- src/javascript/webgl-rendering-context.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/javascript/webgl-rendering-context.js b/src/javascript/webgl-rendering-context.js index 0319be5e..3656acd1 100644 --- a/src/javascript/webgl-rendering-context.js +++ b/src/javascript/webgl-rendering-context.js @@ -1304,7 +1304,7 @@ class WebGLRenderingContext extends NativeWebGLRenderingContext { if (typeof data === 'object') { let u8Data = null - if (isTypedArray(data)) { + if (isTypedArray(data) || data instanceof DataView) { u8Data = unpackTypedArray(data) } else if (data instanceof ArrayBuffer) { u8Data = new Uint8Array(data) @@ -1386,7 +1386,7 @@ class WebGLRenderingContext extends NativeWebGLRenderingContext { } let u8Data = null - if (isTypedArray(data)) { + if (isTypedArray(data) || data instanceof DataView) { u8Data = unpackTypedArray(data) } else if (data instanceof ArrayBuffer) { u8Data = new Uint8Array(data)