Vertex buffer is not big enough for the draw call only on mac computers

It’s crazy but I just have solved the problem in 30 seconds using ChatGPT.

And here is the answer:

The error message suggests that the size of the vertex buffer is not sufficient for rendering all the triangles you want to generate. In the provided code, the size of the vertex buffer is set to 150, which corresponds to 16 triangles. If you want to render 50 triangles, you need to adjust the size of the vertex buffer accordingly.

To do this, you can change the size of the vertices array from new Float32Array(150) to new Float32Array(50 * 3 * 3). This will allocate enough memory for 50 triangles, each with 3 vertices that each have 3 coordinates (x, y, z). Additionally, you should also adjust the loop limits in your code from for (let i = 0; i < 16; i++) to for (let i = 0; i < 50; i++) to generate 50 triangles.

With these changes, the code should be able to generate and render 50 triangles without the GL_INVALID_OPERATION error.

1 Like