opengl es - mat3 attribute in WebGL -
i'm attempting use angle_instanced_arrays extension in webgl render multiple instances of object different mat3 transformation matrices. code related buffer matrices:
//setup this.shaderprogram.transformattribute = gl.getattriblocation(this.shaderprogram, "transform"); ext.vertexattribdivisorangle(this.shaderprogram.transformattribute, 1); this.transformbuffer = gl.createbuffer(); //each render gl.enablevertexattribarray(this.shaderprogram.transformattribute); gl.bindbuffer(gl.array_buffer, this.transformbuffer); gl.bufferdata(gl.array_buffer, new float32array([/*9 floats per instance*/]), gl.stream_draw); gl.vertexattribpointer(this.shaderprogram.transformattribute, 9, gl.float, false, 0, 0);
and in vertex shader, have 'attribute mat3 transform;' instead of 'uniform mat3 transform'.
when execute code above, error on vertexattribpointer: "vertexattribpointer: bad size or stride".
this error persists if set stride 36 (9 * 4-byte float) or 0 (auto?).
(as aside, why have specify count, type, , stride? under circumstances stride not product of count , size of type?)
Comments
Post a Comment