I'm trying to use the texImage2d, my ArrayBufferView have a type Int16Array and when I'm using the texImage2D with type INT return me this error:
WebGL: INVALID_ENUM: texImage2D: invalid type
this is the declaration of my texImage2D:
this.gl.bindTexture(this.gl.TEXTURE_2D, this.texture);
this.gl.texImage2D(
this.gl.TEXTURE_2D,
0,
this.gl.LUMINANCE,
imageH,
imageW,
0,
this.gl.LUMINANCE,
this.gl.INT,
texture_array_buffer
);
If I use UNSIGNED_BYTE or UNSIGNED_INT I always have the same problem.
I need to use a BufferView of type Int16Array instead of Float32Array.
How can specify a type INT with this ArrayBufferView with Int16Array??
LUMINANCEis a WebGL 1 unsized format and doesn't support any type other thanUNSIGNED_BYTE. You need to use WebGL 2sR16Iformat andSHORTas datatype.