From b5b357c13273ff13e81f11cdc1bbc2a8231edfca Mon Sep 17 00:00:00 2001 From: sebavan Date: Wed, 3 Aug 2022 20:34:13 +0200 Subject: [PATCH] Add support for Integer attributes (#12830) * fix native sprites * Babylon Native Sprites * Add support for vertexAttribIPointer --- packages/dev/core/src/Engines/thinEngine.ts | 6 +++++- packages/dev/core/src/LibDeclarations/webgl2.d.ts | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/dev/core/src/Engines/thinEngine.ts b/packages/dev/core/src/Engines/thinEngine.ts index d75c5f7a554..9713dc62a9a 100644 --- a/packages/dev/core/src/Engines/thinEngine.ts +++ b/packages/dev/core/src/Engines/thinEngine.ts @@ -2239,7 +2239,11 @@ export class ThinEngine { if (changed || this._vaoRecordInProgress) { this.bindArrayBuffer(buffer); - this._gl.vertexAttribPointer(indx, size, type, normalized, stride, offset); + if (type === this._gl.UNSIGNED_INT || type === this._gl.INT) { + this._gl.vertexAttribIPointer(indx, size, type, stride, offset); + } else { + this._gl.vertexAttribPointer(indx, size, type, normalized, stride, offset); + } } } diff --git a/packages/dev/core/src/LibDeclarations/webgl2.d.ts b/packages/dev/core/src/LibDeclarations/webgl2.d.ts index b32f5d7d927..340d6b2635a 100644 --- a/packages/dev/core/src/LibDeclarations/webgl2.d.ts +++ b/packages/dev/core/src/LibDeclarations/webgl2.d.ts @@ -127,6 +127,8 @@ interface WebGLRenderingContext { clearBufferiv(buffer: number, drawbuffer: number, values: ArrayBufferView, srcOffset: number | null): void; clearBufferuiv(buffer: number, drawbuffer: number, values: ArrayBufferView, srcOffset: number | null): void; clearBufferfi(buffer: number, drawbuffer: number, depth: number, stencil: number): void; + + vertexAttribIPointer(index: number, size: number, type: number, stride: number, offset: number): void; } interface ImageBitmap {