Skip to content

Commit

Permalink
Fix misuse of offset in updatedynamicbuffer (#16147)
Browse files Browse the repository at this point in the history
Co-authored-by: David Catuhe <david@catuhe.com>
  • Loading branch information
deltakosh and David Catuhe authored Feb 5, 2025
1 parent 69cdc19 commit c9fbe99
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ ThinEngine.prototype.updateDynamicVertexBuffer = function (this: ThinEngine, ver
}
} else {
if (data instanceof Array) {
this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(data).subarray(byteOffset, byteOffset + byteLength));
this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, new Float32Array(data).subarray(0, byteLength / 4));
} else {
if (data instanceof ArrayBuffer) {
data = new Uint8Array(data, byteOffset, byteLength);
data = new Uint8Array(data, 0, byteLength);
} else {
data = new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);
data = new Uint8Array(data.buffer, data.byteOffset, byteLength);
}

this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);
this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, data);
}
}

Expand Down

0 comments on commit c9fbe99

Please sign in to comment.