Note: the general question has been asked before, but this sort of error seems to really depend on specifics. Apologies if this is indeed a duplicate
I am getting the "out of range" error for the attribute a_Morph_0
, despite checking numerous things:
- The attribute exists in the shader
- I am using VAO's, and tried releasing it (setting to null)
- The pipeline works fine with other data
- I encountered this error previously and fixed by just chopping stuff off the fragment shader, but that didn't help this time
- Switching the order of
a_Position
anda_Morph_0
changes the error accordingly, i.e. it still references a_Morph_0.
The vertex shader code:
attribute vec4 a_Position;
attribute vec4 a_Morph_0;
attribute vec4 a_Morph_1;
uniform float u_MorphWeights[2];
uniform mat4 u_MVPMatrix;
uniform mat4 u_ModelMatrix;
void main() {
vec4 m_Position = a_Position;
m_Position += (u_MorphWeights[0] * a_Morph_0);
m_Position += (u_MorphWeights[1] * a_Morph_1);
gl_Position = u_MVPMatrix * m_Position;
}
Some relevant data:
- data for
elements
: Uint16Array(3) [0, 1, 2] - data for attribute
a_Position
: Float32Array(9) [0, 0, 0, 1, 0, 0, 0.5, 0.5, 0] - data for attribute
a_Morph_0
: Float32Array(9) [0, 0, 0, 0, 0, 0, -1, 1, 0] - data for attribute
a_Morph_1
: Float32Array(9) [0, 0, 0, 0, 0, 0, 1, 1, 0]
The draw call is with count of 3. Specifically:
gl.drawElements(4, 3, 5123, 0);
Screenshot from Spector:
Anything else I should be checking?