RaulJ
RaulJ

Reputation: 33

GL_INVALID_OPERATION: Insufficient buffer size

i'm trying to paint some models 3D using javascript with webgl2 and i can't undestand the problem i get:

[.WebGL-00000188C244F2D0] GL_INVALID_OPERATION: Insufficient buffer size.

I suposse it is about the buffers but y don't know why, i have the buffers like that:

 if (positions && positions.length != 0) {
    const positionBuffer = gl.createBuffer();
    gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
    gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW);
    gl.vertexAttribPointer(0, 4, gl.FLOAT, false, 0, 0);
    gl.enableVertexAttribArray(0);
}

Model 3D:

positions: 1146 normals: 1146 uvs: 72 indices: 8360

If you need more code say to me!

Thanks!

Upvotes: 1

Views: 6504

Answers (1)

Elyess Eleuch
Elyess Eleuch

Reputation: 141

I guess the problem is gl.vertexAttribPointer, you are giving 0 at the beginning, ut I guess you should look up first the coords of your variable in the shader with getAttribLocation and then pass it to that function

Upvotes: 1

Related Questions